When executing Flutter run I'm getting the following error due to incompatibilities with the Camera plugin library.
Any ideas?
/Users/radsen/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.8.1/android/src/main/java/io/flutter/plugins/camera/CameraPer
missions.java:12: error: package androidx.core.app does not exist
import androidx.core.app.ActivityCompat;
^
/Users/radsen/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.8.1/android/src/main/java/io/flutter/plugins/camera/CameraPer
missions.java:13: error: package androidx.core.content does not exist
import androidx.core.content.ContextCompat;
^
/Users/radsen/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.8.1/android/src/main/java/io/flutter/plugins/camera/CameraZoo
m.java:10: error: package androidx.core.math does not exist
import androidx.core.math.MathUtils;
^
/Users/radsen/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.8.1/android/src/main/java/io/flutter/plugins/camera/CameraPer
missions.java:45: error: cannot find symbol
ActivityCompat.requestPermissions(
^
symbol: variable ActivityCompat
location: class CameraPermissions
/Users/radsen/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.8.1/android/src/main/java/io/flutter/plugins/camera/CameraPer
missions.java:58: error: cannot find symbol
return ContextCompat.checkSelfPermission(activity, permission.CAMERA)
^
symbol: variable ContextCompat
location: class CameraPermissions
/Users/radsen/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.8.1/android/src/main/java/io/flutter/plugins/camera/CameraPer
missions.java:63: error: cannot find symbol
return ContextCompat.checkSelfPermission(activity, permission.RECORD_AUDIO)
^
symbol: variable ContextCompat
location: class CameraPermissions
/Users/radsen/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.8.1/android/src/main/java/io/flutter/plugins/camera/CameraZoo
m.java:41: error: cannot find symbol
final float newZoom = MathUtils.clamp(zoom, DEFAULT_ZOOM_FACTOR, this.maxZoom);
^
symbol: variable MathUtils
location: class CameraZoom
7 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 5s
[ +7 ms] Exception: The plugin camera could not be built due to the issue above.
That is a problem with SDK vs plugin compatibility
Go to your build.grade file and check those:
android {
compileSdkVersion 30 // must be 30 for compatibility
defaultConfig {
applicationId "tv.digicash"
minSdkVersion 23
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Check those too in Android Studio at your File > Project Structure (Project and SDKs left menus)
They must be 30 or superior
Related
I'm using Android Studio for the first time and I got the following error after importing the project (previously it was an eclipse project where I had issues too.)
Here is the information given:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/home/crash-id/Development/SDK/adt-bundle-linux-x86_64-20140702/sdk/build-tools/21.1.2/dx --dex --no-optimize --output /home/crash-id/AndroidstudioProjects/LocalSin/app/build/intermediates/dex/debug --input-list=/home/crash-id/AndroidstudioProjects/LocalSin/app/build/intermediates/tmp/dex/debug/inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/home/crash-id/Development/SDK/adt-bundle-linux-x86_64-20140702/sdk/build-tools/21.1.2/dx --dex --no-optimize --output /home/crash-id/AndroidstudioProjects/LocalSin/app/build/intermediates/dex/debug --input-list=/home/crash-id/AndroidstudioProjects/LocalSin/app/build/intermediates/tmp/dex/debug/inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
The app build.gradle is this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.myapp.test"
minSdkVersion 11
targetSdkVersion 14
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:+'
compile files('libs/google-play-services.jar')
compile files('libs/httpcore-4.3.2.jar')
compile files('libs/httpmime-4.3.4.jar')
}
And the project built.gradle is this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Do you have any idea what the problem could be and how can it be solved? A good explanation for the problem would be useful too as I am new to Android Studio. Thanks in advance :)
compile 'com.google.android.gms:play-services:+'
compile files('libs/google-play-services.jar')
I think you should remove 1 of those lines.
cd android/ && ./gradlew clean && cd .. && react-native run-android
I had the Android Studio Error:Execution failed for task ':app:dexDebug' that i solve it by setting multiDexEnabled to true
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
Too many library were used in my project so i exceed the 65K methods dex limit imposed by Android for more information see : http://developer.android.com/tools/building/multidex.html
This happens because you are duplicating the library dependency inside of app build.gradle in android studio.
Android Studio automatically adds the dependencies for all the files in the libs folder by using
compile fileTree(dir: 'libs', include: ['*.jar'])
or in your specific case the dependency is added using
compile files('libs/google-play-services.jar')
^ Now when you try to add the dependency again by using
compile 'com.google.android.gms:play-services:+'
you get the error.
SOLUTION
Remove all duplicate dependencies added inside the "app build.gradle" and you should be good to go.In your case remove
compile 'com.google.android.gms:play-services:+'
avoid to include whole gms library:
compile 'com.google.android.gms:play-services:+'
Instead, just use required components in this way:
compile 'com.google.android.gms:play-services-ads:8.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
Ensure that the Package names are not duplicated across the projects being compiled
In #Drivers' answer, it is pointed out that in a given project, there should not be multiple dependencies that have the same namespace. In the case above, the Google Play Services library had been included twice, and thus caused a package name conflict.
The same can also happen across multiple modules (apps, libraries etc.) in the same project. So, ensure that for each AndroidManifest.xml file, the package name is unique across all modules:-
AndroidManifest.xml:
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="this.must.be.unique.across.modules">
I had the below code on gradle file and same error.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.google.android.gms:play-services-ads:8.3.0'
}
dependencies {
compile 'com.android.support:design:23.+'
}
dependencies {
compile 'com.android.support:design:23.+'
}
dependencies {
compile 'com.android.support:design:23.+'
}
Removed those last 3 dependencies and now its working!
delete all files in c:\users\<username>\.gradle\caches\transforms-2\files-2.1\
Enjoy the command flutter run
When I run this command
flutter run --release
flutter build web --web-renderer html
I get this error in console:
Launching lib\main.dart on Infinix X656 in release mode...
/C:/Users/Bilal%20Saeed/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/blue_thermal_printer-1.1.9/lib/blue_thermal_printer.dart:34:28: Error: Type 'Registrar' not
found.
static void registerWith(Registrar registrar) {
^^^^^^^^^
/C:/Users/Bilal%20Saeed/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/blue_thermal_printer-1.1.9/lib/blue_thermal_printer.dart:34:28: Error: 'Registrar' isn't a
type.
static void registerWith(Registrar registrar) {
^^^^^^^^^
/C:/Users/Bilal%20Saeed/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/blue_thermal_printer-1.1.9/lib/blue_thermal_printer.dart:35:24: Error: Setter not found: 'i
nstance'.
BlueThermalPrinter.instance = BlueThermalPrinter._();
^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'D:\All Data\Softwares\Latest Flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005
* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command 'D:\All Data\Softwares\Latest Flutter\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* 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 3m 57s
Running Gradle task 'assembleRelease'... 240.3s
Exception: Gradle task assembleRelease failed with exit code 1
This file is also automatically generated with errors:
//
// Generated file. Do not edit.
//
// ignore_for_file: directives_ordering
// ignore_for_file: lines_longer_than_80_chars
import 'package:blue_thermal_printer/';
import 'package:cloud_firestore_web/cloud_firestore_web.dart';
import 'package:cloud_functions_web/cloud_functions_web.dart';
import 'package:connectivity_for_web/connectivity_for_web.dart';
import 'package:firebase_analytics_web/firebase_analytics_web.dart';
import 'package:firebase_auth_web/firebase_auth_web.dart';
import 'package:firebase_core_web/firebase_core_web.dart';
import 'package:firebase_messaging_web/firebase_messaging_web.dart';
import 'package:firebase_storage_web/firebase_storage_web.dart';
import 'package:fluttertoast/fluttertoast_web.dart';
import 'package:geolocator_web/geolocator_web.dart';
import 'package:google_maps_flutter_web/google_maps_flutter_web.dart';
import 'package:google_sign_in_web/google_sign_in_web.dart';
import 'package:image_picker_for_web/image_picker_for_web.dart';
import 'package:maps_launcher/maps_launcher_web.dart';
import 'package:shared_preferences_web/shared_preferences_web.dart';
import 'package:url_launcher_web/url_launcher_web.dart';
import 'package:video_player_web/video_player_web.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
// ignore: public_member_api_docs
void registerPlugins(Registrar registrar) {
BlueThermalPrinterPlugin.registerWith(registrar);
FirebaseFirestoreWeb.registerWith(registrar);
FirebaseFunctionsWeb.registerWith(registrar);
ConnectivityPlugin.registerWith(registrar);
FirebaseAnalyticsWeb.registerWith(registrar);
FirebaseAuthWeb.registerWith(registrar);
FirebaseCoreWeb.registerWith(registrar);
FirebaseMessagingWeb.registerWith(registrar);
FirebaseStorageWeb.registerWith(registrar);
FluttertoastWebPlugin.registerWith(registrar);
GeolocatorPlugin.registerWith(registrar);
GoogleMapsPlugin.registerWith(registrar);
GoogleSignInPlugin.registerWith(registrar);
ImagePickerPlugin.registerWith(registrar);
MapsLauncherWeb.registerWith(registrar);
SharedPreferencesPlugin.registerWith(registrar);
UrlLauncherPlugin.registerWith(registrar);
VideoPlayerPlugin.registerWith(registrar);
registrar.registerMessageHandler();
}
As well I constantly see these errors in dart analysis :
error: Target of URI doesn't exist: 'package:blue_thermal_printer/'. (uri_does_not_exist at [food_delivery_app] lib\generated_plugin_registrant.dart:8)
error: Undefined name 'BlueThermalPrinterPlugin'. (undefined_identifier at [food_delivery_app] lib\generated_plugin_registrant.dart:31)
However in debug mode, the app works fine.
And when I remove bluetooth_thermal_print package, it works fine as well too.
What could be the issue? How can I release my app with this package?
It seems as if this plugin would not be properly installed.
Make sure the pubspec.yaml has the dependency listed:
dependencies:
blue_thermal_printer: ^any
Then you can let fetch it fetch the files:
flutter packages get
While on the other hand, you're creating a web project
and then install a plugin, which possibly is rather for Android, iOS or HarmonyOS. flutter config --no-enable-web would disable the web support, which is a possible (even quite likely) candidate for the cause of that error message.
And even if some libraries may provide this kind of functionality in a web-browser
any kind of ESC/POS might be easier to handle without all the abstraction layers.
You may want to follow issue #103 ...which only confirms my educated guess.
Heads off to the developer of this package. I contacted him personally by going to his portfolio given on pub.dev and told him the situation. He updated the package from bluetooth_thermal_printer 1.1.9 to 1.2.0 in about minutes and it all worked smoothly once again....
Tried to run my flutter app on a physical device, and the following error keeps showing:
Launching lib/main.dart on Pixel 3a in debug mode...
Running Gradle task 'assembleDebug'...
Note: /Users/jasonlloyd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/google_api_availability-2.0.4/android/src/main/java/com/baseflow/googleapiavailability/GoogleApiAvailabilityPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/jasonlloyd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.3.0/android/src/main/java/io/flutter/plugins/firebase/core/FlutterFirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/jasonlloyd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-2.2.2/android/src/main/java/io/flutter/plugins/firebase/firestore/FlutterFirebaseFirestorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/jasonlloyd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-2.2.2/android/src/main/java/io/flutter/plugins/firebase/firestore/streamhandler/TransactionStreamHandler.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
/Users/jasonlloyd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/location_permissions-3.0.0+1/android/src/main/java/com/baseflow/location_permissions/LocationPermissionsPlugin.java:284: error: cannot find symbol
|| (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && permission.equals(Manifest.permission.ACCESS_BACKGROUND_LOCATION));
^
symbol: variable Q
location: class VERSION_CODES
/Users/jasonlloyd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/location_permissions-3.0.0+1/android/src/main/java/com/baseflow/location_permissions/LocationPermissionsPlugin.java:284: error: cannot find symbol
|| (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && permission.equals(Manifest.permission.ACCESS_BACKGROUND_LOCATION));
^
symbol: variable ACCESS_BACKGROUND_LOCATION
location: class permission
/Users/jasonlloyd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/location_permissions-3.0.0+1/android/src/main/java/com/baseflow/location_permissions/LocationPermissionsPlugin.java:308: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
^
symbol: variable Q
location: class VERSION_CODES
/Users/jasonlloyd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/location_permissions-3.0.0+1/android/src/main/java/com/baseflow/location_permissions/LocationPermissionsPlugin.java:309: error: cannot find symbol
names.add(Manifest.permission.ACCESS_BACKGROUND_LOCATION);
^
symbol: variable ACCESS_BACKGROUND_LOCATION
location: class permission
/Users/jasonlloyd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/location_permissions-3.0.0+1/android/src/main/java/com/baseflow/location_permissions/LocationPermissionsPlugin.java:330: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && hasPermissionInManifest(Manifest.permission.ACCESS_BACKGROUND_LOCATION, context)) {
^
symbol: variable Q
location: class VERSION_CODES
/Users/jasonlloyd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/location_permissions-3.0.0+1/android/src/main/java/com/baseflow/location_permissions/LocationPermissionsPlugin.java:330: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && hasPermissionInManifest(Manifest.permission.ACCESS_BACKGROUND_LOCATION, context)) {
^
symbol: variable ACCESS_BACKGROUND_LOCATION
location: class permission
/Users/jasonlloyd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/location_permissions-3.0.0+1/android/src/main/java/com/baseflow/location_permissions/LocationPermissionsPlugin.java:331: error: cannot find symbol
permissionNames.add(Manifest.permission.ACCESS_BACKGROUND_LOCATION);
^
symbol: variable ACCESS_BACKGROUND_LOCATION
location: class permission
/Users/jasonlloyd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/location_permissions-3.0.0+1/android/src/main/java/com/baseflow/location_permissions/LocationPermissionsPlugin.java:372: error: cannot find symbol
return locationManager.isLocationEnabled();
^
symbol: method isLocationEnabled()
location: variable locationManager of type LocationManager
Note: /Users/jasonlloyd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/location_permissions-3.0.0+1/android/src/main/java/com/baseflow/location_permissions/LocationPermissionsPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
8 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':location_permissions:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 10s
Exception: Gradle task assembleDebug failed with exit code 1
I've tried following the advice here: Execution Failed for task :app:compileDebugJavaWithJavac in Android Studio but doesn't work still. Any ideas?
Did you allow Background location in Manifest?
<manifest ... >
<!-- Required only when requesting background location access on
Android 10 (API level 29) and higher. -->
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
</manifest>
Solved! I simply needed to update one of my dependencies in pubspec.yaml to the latest version, specifically changing location pacakage to location: ^4.3.0. Hope this helps someone in the future.
Can anybody tell me what to do about these error. Everything is working fine when I run the same app on ios. For android I am getting the below exception. One error is plugin not found. Another one is some compilation issues.
Plugin project :firebase_auth_web not found. Please update settings.gradle.
Plugin project :firebase_core_web not found. Please update settings.gradle.
Plugin project :cloud_firestore_web not found. Please update settings.gradle.
Note: /Users/daljitsingh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
/Users/daljitsingh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.java:8: error: package android.support.annotation does not exist
import android.support.annotation.VisibleForTesting;
^
symbol: class VisibleForTesting
location: class ImagePickerDelegate
/Users/daljitsingh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:73: error: cannot find symbol
#VisibleForTesting static final int REQUEST_CODE_TAKE_VIDEO_WITH_CAMERA = 2353;
^
symbol: class VisibleForTesting
location: class ImagePickerDelegate
/Users/daljitsingh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:74: error: cannot find symbol
#VisibleForTesting static final int REQUEST_EXTERNAL_VIDEO_STORAGE_PERMISSION = 2354;
^
symbol: class VisibleForTesting
FAILURE: Build failed with an exception.
Update the Android Integration part of each of these plugins pub page: https://pub.dev/packages/firebase_auth ...
I want to integrate mapbox using flutter
The thing I am doing is just installing my sdk in pubsec.yaml and placing the access token in Android Manifest file and Info.plist
Here is my pubsec.yaml where I am adding mapbox_gl
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.2
mapbox_gl: ^0.0.3
I have not yet added any code in dart file and just trying to run the application but it gives me the error
/flutter/.pub-cache/hosted/pub.dartlang.org/mapbox_gl-0.0.3/android/src/main/java/com/mapbox/mapboxgl/MapboxMapController.java:16: error: cannot find symbol
import androidx.annotation.NonNull;
^
symbol: class NonNull
location: package androidx.annotation
/flutter/.pub-cache/hosted/pub.dartlang.org/mapbox_gl-0.0.3/android/src/main/java/com/mapbox/mapboxgl/MapboxMapController.java:130: error: cannot find symbol
private static String getAccessToken(#NonNull Context context) {
^
symbol: class NonNull
location: class MapboxMapController
/flutter/.pub-cache/hosted/pub.dartlang.org/mapbox_gl-0.0.3/android/src/main/java/com/mapbox/mapboxgl/MapboxMapController.java:298: error: cannot find symbol
private void enableLocationComponent(#NonNull Style style) {
^
symbol: class NonNull
location: class MapboxMapController
/flutter/.pub-cache/hosted/pub.dartlang.org/mapbox_gl-0.0.3/android/src/main/java/com/mapbox/mapboxgl/MapboxMapController.java:315: error: cannot find symbol
private void enableSymbolManager(#NonNull Style style) {
^
symbol: class NonNull
location: class MapboxMapController
/flutter/.pub-cache/hosted/pub.dartlang.org/mapbox_gl-0.0.3/android/src/main/java/com/mapbox/mapboxgl/MapboxMapController.java:326: error: cannot find symbol
private void enableLineManager(#NonNull Style style) {
^
symbol: class NonNull
location: class MapboxMapController
/flutter/.pub-cache/hosted/pub.dartlang.org/mapbox_gl-0.0.3/android/src/main/java/com/mapbox/mapboxgl/MapboxMapController.java:333: error: cannot find symbol
private void enableCircleManager(#NonNull Style style) {
^
symbol: class NonNull
location: class MapboxMapController
/flutter/.pub-cache/hosted/pub.dartlang.org/mapbox_gl-0.0.3/android/src/main/java/com/mapbox/mapboxgl/MapboxMapController.java:556: error: cannot find symbol
public boolean onMapClick(#NonNull LatLng point) {
^
symbol: class NonNull
location: class MapboxMapController
/flutter/.pub-cache/hosted/pub.dartlang.org/mapbox_gl-0.0.3/android/src/main/java/com/mapbox/mapboxgl/MapboxMapController.java:286: error: cannot find symbol
public void onStyleLoaded(#NonNull Style style) {
^
symbol: class NonNull
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
8 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':mapbox_gl:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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.
BUILD FAILED in 4s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
*******************************************************************************************
Finished with error: Gradle task assembleDebug failed with exit code 1
Any help is appreciated.
That's an AndroidX compatibility issue.
Add this to your android/gradle.properties and try to build again:
android.enableJetifier=true
android.useAndroidX=true
(Official docs about AndroidX migration on Flutter)