i don't know what was the error , it says
Unknown JVM target version: 1.2
Supported versions: 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17
image
i don't konw where it's come from
i did try flutter clean , flutter pub get , flutter repair , cach clean etc....
nothing work for me
change jvmTarget to these versions 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17
the bug on you'r android level gradle
kotlinOptions {
jvmTarget = '1.8'
}
Related
I got this error when I want to compile my Flutter code to my Phone (I don't have a powerful laptop to run emulator). The error happen after I updated my flutter SDK from version 2.5 to the latest version.
The first error is I have to update my compileSdkVersion from 30 to 31, but I manage to handle it. The second error is my ext.kotlin_version is too low, so I change it to the latest version and yes I can handle it to. But this, the third one makes me confused and I don't know what to do.
This is the third error
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not download kotlin-gradle-plugin-1.6.10.jar (org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10)
> Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.6.10/kotlin-gradle-plugin-1.6.10.jar'.
> Premature end of Content-Length delimited message body (expected: 9,121,085; received: 3,637,248)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 15m 37s
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Note: C:\Users\<my real name>\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\path_provider_android-2.0.11\android\src\main\java\io\flutter\plugins\pathprovider\PathProviderPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
android\build.gradle
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android\app\build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 31
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.project_ukk"
minSdkVersion 21
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation platform('com.google.firebase:firebase-bom:29.0.4')
implementation 'com.google.firebase:firebase-analytics'
implementation "androidx.multidex:multidex:2.0.1"
}
android\gradle\wrapper\gradle-wrapper.properties
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
The good news is my code is successfully compiled on my phone, but I'm afraid that the error will ruin my project in the future.
Flutter Doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.10.1, on Microsoft Windows [Version 10.0.19043.1526], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2020.3)
[√] VS Code (version 1.64.1)
[√] Connected device (4 available)
[√] HTTP Host Availability
! Doctor found issues in 1 category.
I can't download Visual Studio because I don't have the space available (all of the space is taken by Android Studio).
I got this error when I run my simple flutter APP. I could not figure out why this error occurred.
Error
Null check operator used on a null value
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_book/src/controller/mapDataController.dart';
import 'package:star_book/src/model/app_settings.dart';
import 'package:star_book/src/model/category.dart';
import 'package:star_book/src/model/map_data.dart';
class MapInformationPage extends StatefulWidget {
late final String selectedMap;
MapInformationPage(this.selectedMap);
#override
_MapInformationPageState createState() => _MapInformationPageState();
}
class _MapInformationPageState extends State<MapInformationPage> {
final _mapController = Get.put(MapDataController());
late final MapData mapData;
late AppSettings _appSettings;
late List<Category> _favoriteIcons;
late int _favoriteIconsIndex;
#override
void initState() {
super.initState();
_appSettings = AppSettings();
_favoriteIcons = [
Category(Icons.favorite_border, Colors.black),
Category(Icons.favorite, Colors.red),
];
_favoriteIconsIndex = 0;
_mapController.selectedMapData(widget.selectedMap);
}
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
onPressed: () {
Get.back();
},
icon: Icon(Icons.arrow_back),
iconSize: 24,
),
backgroundColor: _appSettings.appBarAndNavColor,
),
body: Container(
width: _appSettings.appWidth * 0.9,
height: _appSettings.appHeight - _appSettings.appBarHeight,
child: ListView(children: [
Container(
child: GetBuilder(
builder: (_) {
return Text(
'map > star1 >' + _mapController.mapData.name.toString(),
style: TextStyle(fontSize: 20),
);
},
),
),
]),
),
);
}
}
My flutter doctor output
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19043.1165], locale ko-KR)
• Flutter version 2.2.3 at C:\Program Files\flutter
• Framework revision f4abaa0735 (8 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\HOME\AppData\Local\Android\sdk
• Platform android-30, build-tools 29.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.59.1)
• VS Code at C:\Users\HOME\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.25.0
[√] Connected device (3 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.159
• Edge (web) • edge • web-javascript • Microsoft Edge 92.0.902.78
Can anyone provide a solution for this?
Normally, "Null check operator used on a null value" is throw when
var v = null;
var s = v!.value; <--"Null check operator used on a null value"
You can check the simple flutter APP codes.
Also, this may help: Null check operator used on a null value
It's most probably you are using SDK of flutter which employs null safety.
Edit your pubspec.yaml with fluuter sdk less than 2.12 or ensure null safety in your code.
I'm trying to write an app with the use of the WebView in flutter. However, i'm receiving the error described below:
compiler message:
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.22+1/lib/webview_flutter.Dart:395:37: Error: The argument type 'AutoMediaPlaybackPolicy/*1*/' can't be assigned to the parameter type 'AutoMediaPlaybackPolicy/*2*/'.
- 'AutoMediaPlaybackPolicy/*1*/' is from 'package:webview_flutter/webview_flutter.Dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.22+1/lib/webview_flutter.Dart').
- 'AutoMediaPlaybackPolicy/*2*/' is from 'package:webview_flutter/webview_flutter.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.22+1/lib/webview_flutter.dart').
autoMediaPlaybackPolicy: widget.initialMediaPlaybackPolicy,
^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.22+1/lib/webview_flutter.Dart:401:28: Error: The argument type 'JavascriptMode/*1*/' can't be assigned to the parameter type 'JavascriptMode/*2*/'.
- 'JavascriptMode/*1*/' is from 'package:webview_flutter/webview_flutter.Dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.22+1/lib/webview_flutter.Dart').
- 'JavascriptMode/*2*/' is from 'package:webview_flutter/webview_flutter.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.22+1/lib/webview_flutter.dart').
javascriptMode: widget.javascriptMode,
^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.22+1/lib/webview_flutter.Dart:426:31: Error: A value of type 'JavascriptMode/*1*/' can't be assigned to a variable of type 'JavascriptMode/*2*/'.
- 'JavascriptMode/*1*/' is from 'package:webview_flutter/webview_flutter.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.22+1/lib/webview_flutter.dart').
- 'JavascriptMode/*2*/' is from 'package:webview_flutter/webview_flutter.Dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.22+1/lib/webview_flutter.Dart').
javascriptMode = newValue.javascriptMode;
^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.22+1/lib/webview_flutter.Dart:439:21: Error: The argument type 'JavascriptMode/*1*/' can't be assigned to the parameter type 'JavascriptMode/*2*/'.
- 'JavascriptMode/*1*/' is from 'package:webview_flutter/webview_flutter.Dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.22+1/lib/webview_flutter.Dart').
- 'JavascriptMode/*2*/' is from 'package:webview_flutter/webview_flutter.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.22+1/lib/webview_flutter.dart').
javascriptMode: javascriptMode,
I created a separate app only using WebView (to test my environment) and that's running correctly. I don't understand because in the first application (with error) presents the issue. If I remove all code related to WebView the compiler message still the same, i.e, the problem happens when I do the import in the package. The pubspec.yaml is identical in the two Applications.
The respective code:
import 'package:webview_flutter/webview_flutter.Dart';
class WebViewContainer extends StatefulWidget {
final url;
WebViewContainer(this.url);
#override
createState() => _WebViewContainerState(this.url);
}
class _WebViewContainerState extends State<WebViewContainer> {
var _url;
final _key = UniqueKey();
_WebViewContainerState(this._url);
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Column(
children: [
Expanded(
child: WebView(
key: _key,
javascriptMode: JavascriptMode.unrestricted,
initialUrl: _url))
],
));
}
}
The piece of code where the action happens:
class CursoDeNoivos extends StatelessWidget{
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Curso de Noivos"),
centerTitle: true,
backgroundColor: Colors.deepPurple,
),
body:SingleChildScrollView(
child: Column(
children: <Widget>[
Expanded(
child: Padding(
padding: EdgeInsets.only(left: 1.0, top: 1.0, right: 1.0, bottom: 1.0),
child: Container(
height: button_height,
child: buildIconButton("Inscrições", _insc, context, Icons.add_circle_outline),
)
),
)
],
The action when the button is pressed:
Widget buildIconButton(String _text, Object _obj, BuildContext _context, IconData _icon) {
return RaisedButton.icon(
onPressed: (){
//Navigator.push(_context, MaterialPageRoute(builder: (context) => _obj));
Navigator.push(_context, MaterialPageRoute(builder: (context) => WebViewContainer('https://google.com')));
},
icon: Icon(_icon, color: Colors.white, size: 30.0,),
label: Text(_text, style: TextStyle(color: Colors.white, fontSize: 20), textAlign: TextAlign.left),
color: Colors.deepPurple,
);
}
The pubspec.yaml file:
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
webview_flutter: ^0.3.3
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
assets:
- images/casados.jpg
- images/noivos.jpg
The Flutter doctor results:
C:\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel beta, v1.17.0, on Microsoft Windows [versão 10.0.18362.836], locale pt-BR)
• Flutter version 1.17.0 at C:\flutter
• Framework revision e6b34c2b5c (4 weeks ago), 2020-05-02 11:39:18 -0700
• Engine revision 540786dd51
• Dart version 2.8.1
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc4)
• Android SDK at C:\Users\feps\AppData\Local\Android\sdk
• Platform android-29, build-tools 30.0.0-rc4
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code, 64-bit edition (version 1.24.0)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 2.21.1
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
• No issues found!
Process finished with exit code 0
I've got no idea about the cause of the issue...
(I'm new in Flutter or Apps development)
I’m having isues with ionic cordova run android -l
everything was working good. I’ve updated my nodejs on pc. Now i’m having isues with build.
[app-scripts] [10:41:36] sass started ...
[app-scripts] [10:41:37] sass: src/theme/variables.scss, line: 36
[app-scripts] (skyblue: #488aff, primaryText: #727270, headers: #5e5e5e, secondary: #32db64, danger: #ca2929, light:
[app-scripts] #f4f4f4, dark: #222, orange: #fc6108, sos: #7a08fc, blu: #3e6aca, gray: #7e7e7e, activeBg: #dadedf,
[app-scripts] disabled: (contrast: #aaaaaa, base: #e7e7e7), green: (contrast: #fafafa, base: #2ecc71), primary: (contrast:
[app-scripts] #f4f4f4, base: #727270), primary-menu: (contrast: #33cfff, base: #f4f4f4), redIcons: (contrast: #ca2929,
[app-scripts] base: #f4f4f4)) isn't a valid CSS value.
[app-scripts] L36: $colors:(
[app-scripts] L37: skyblue: #488aff,
[INFO] Development server running!
IONIC INFO
Ionic CLI : 5.4.1 (/Users/pc-areaindustries/.npm-global/lib/node_modules/ionic) Ionic Framework :
ionic-angular 3.9.8 #ionic/app-scripts : 3.2.4 Cordova: Cordova CLI : 9.0.0 (cordova-lib#9.0.1)
Cordova Platforms : android 7.1.4 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3,
cordova-plugin-ionic-webview 4.0.0, (and 20 other plugins) Utility: cordova-res : 0.6.0 native-run : 0.2.7 (update available: 0.2.8)
System: Android SDK Tools : 26.1.1 (/Users/pc-areaindustries/Library/Android/sdk)
ios-deploy : 1.9.4 ios-sim : 7.0.0 NodeJS : v10.16.0 (/usr/local/bin/node) npm : 6.11.3 OS : macOS Mojave Xcode : Xcode 10.1 Build version 10B61
Inside Variable.scss i have this var
$colors:(
skyblue: #488aff,
primaryText:#727270,
headers: #5e5e5e,
secondary: #32db64,
danger: #ca2929,
light: #f4f4f4,
dark: #222,
orange: #fc6108,
sos: #7a08fc,
blu: #3e6aca,
gray: #7e7e7e,
activeBg: #dadedf,
disabled: (
contrast: #aaaaaa,
base: #e7e7e7
),
green: (
contrast: rgb(250, 250, 250), /* color */
base: #2ecc71 /* background */
),
primary: (
contrast: #f4f4f4,
base: #727270
),
// side menu color
primary-menu: (
contrast: #33cfff,
base: #f4f4f4
),
redIcons: (
contrast: #ca2929,
base: #f4f4f4
),
);
does anyone have the solution? already did this:
removed “node_modules” then npm install
npm update
npm rebuild node-sass
etc
Error was in the variable names. So i solved it by fixing the name.
How to decide what to put for majorVersion and minor in below code.
I was trying to use sqlite3 with vapor and got stuck here.
import PackageDescription
let package = Package(
name: "Hello",
dependencies: [
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 1, minor: 1)
,.Package(url: "https://github.com/vapor/sqlite-driver.git", majorVersion: 1, minor: 0)
,.Package(url: "https://github.com/vapor/sqlite-provider.git", majorVersion: 1, minor: 1)
],
exclude: [
"Config",
"Database",
"Localization",
"Public",
"Resources",
"Tests",
]
)
I am getting error as below when I do vapor build -
Fetching Dependencies [Failed] Check your dependencies' Package.swift
files to see where the conflict is. Error: swift-package: error: The
dependency graph could not be satisfied. The package
(https://github.com/vapor/sqlite-driver.git) with version tag in range
(1.1.0..<1.1.9223372036854775807) is not found. Found tags ([0.0.0,
0.1.0, 0.1.1, 0.2.0, 0.3.0, 0.3.1, 0.3.2, 0.4.0, 0.4.1, 0.5.0, 0.6.0, 0.7.0, 1.0.0, 1.0.1])
The 'dependency graph' error relates to one of your packages depending on a conflicting version of another package. The error messages tells you to 'Check your dependencies' Package.swift files to see where the conflict is.'
You don't need to include both sqlite-driver and sqlite-provider as the latter already has a built-in dependency on the former. Simply remove the dependency on sqlite-driver from your app's Package.swift. Also make sure to vapor clean afterwards.
import PackageDescription
let package = Package(
name: "Hello",
dependencies: [
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 1, minor: 1),
.Package(url: "https://github.com/vapor/sqlite-provider.git", majorVersion: 1, minor: 1)
],
exclude: [
"Config",
"Database",
"Localization",
"Public",
"Resources",
"Tests",
]
)
Note: Vapor is now at version 1.2 so you might want to change the version you are pulling in.