Pub get
The plugins flutter_twitter_login use a deprecated
version of the Android embedding. To avoid unexpected runtime
failures, or future build failures, try to see if these plugins
support the Android V2 embedding. Otherwise, consider removing them
since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the
plugin to the V2 embedding:
https://flutter.dev/go/android-plugin-migration.
Run Console
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-6.1.3\android\src\main\java\com\baseflow\permissionhandler\ServiceManager.java:152: warning: [deprecation] getDefaultAdapter() in BluetoothAdapter has been deprecated
final BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
^
error: warnings found and -Werror specified
1 warning
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':permission_handler: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 4m 37s
try putting this command in the console to update to the latest version of the plugin
flutter pub upgrade --major-versions
Related
Launching lib\main.dart on SM M013F in debug mode...
lib\main.dart:1
C:\fl\flutter.pub-cache\hosted\pub.dartlang.org\permission_handler-7.2.0\android\src\main\java\com\baseflow\permissionhandler\ServiceManager.java:152: warning: [deprecation] getDefaultAdapter() in BluetoothAdapter has been deprecated
final BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
^
error: warnings found and -Werror specified
1 error
1 warning
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':permission_handler: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 16s
Exception: Gradle task assembleDebug failed with exit code 1
Please make sure you have a backup of the project. The permission handler version seems to be too old. Please use version 10.0.0 (latest) if you are using flutter version > 3 or 8.3.0 if less than flutter version 3.. please update the version in pubspec.yaml and try again
I upgraded to the latest Flutter version.
Afterwards it started giving the error...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It is being deprecated in favor of Android embedding v2. Follow the
steps at
https://flutter.dev/go/android-project-migration
to migrate your project. You may also pass the --ignore-deprecation flag to
ignore this check and continue with the deprecated v1 embedding. However,
the v1 Android embedding will be removed in future versions of Flutter.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The detected reason was:
/myAppPath/android/app/src/main/AndroidManifest.xml uses `android:name="io.flutter.app.FutterApplication"`
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Build failed due to use of deprecated Android v1 embedding.
I then went to the migration guide and implemented the required changes which were changing the first line to the second
-android:name="io.flutter.app.FlutterApplication"
+android:name="#{applicationName}"
Now I get the error...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/pathToMyApp/android/app/src/main/AndroidManifest.xml:8:5-51:19: AAPT: error: attribute 'android:name' in <application> tag must be a valid Java class name.
* 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 41s
Running Gradle task 'assembleRelease'... 41.9s
Gradle task assembleRelease failed with exit code 1
Do this
android:name="${applicationName}"
instead of
android:name="#{applicationName}"
I added this code to my flutter pubspec.yaml file
plain_notification_token:
git:
url: https://github.com/zionnite/plain_notification_token.git
but whenever I run the app on my android I encounter an error
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
/Users/apple/.pub-cache/git/plain_notification_token-3709a43167c63bd8f22570afe4fb21fe2e982c39/android/src/main/java/net/kikuchy/plain_notification_token/PlainNotificationTokenPlugin.java:77: error: local variable result is accessed from within inner class; needs to be declared final
result.success(null);
^
/Users/apple/.pub-cache/git/plain_notification_token-3709a43167c63bd8f22570afe4fb21fe2e982c39/android/src/main/java/net/kikuchy/plain_notification_token/PlainNotificationTokenPlugin.java:81: error: local variable result is accessed from within inner class; needs to be declared final
result.success(task.getResult().getToken());
^
Note: /Users/apple/.pub-cache/git/plain_notification_token-3709a43167c63bd8f22570afe4fb21fe2e982c39/android/src/main/java/net/kikuchy/plain_notification_token/PlainNotificationTokenPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':plain_notification_token: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 3m 41s
Exception: Gradle task assembleDebug failed with exit code 1
please how do i resolve this?
The original package was updated recently, perhaps try the official one from pub.dev - https://pub.dev/packages/plain_notification_token, instead of the forked one from GitHub.
plain_notification_token: 0.0.4
`When I try to run flutter build apk
The plugins geocoder, google_map_location_picker use a deprecated version of the Android embedding.
To avoid unexpected runtime failures or future build failures, try to see if these plugins support the Android V2 embedding. Otherwise, consider removing them since a
future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.
Building without sound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety
FAILURE: Build failed with an exception.
What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.40 and higher.
The following dependencies do not satisfy the required version:
project ':google_map_location_picker' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.31
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 6s
Running Gradle task 'assembleRelease'... 11.6s
Gradle task assembleRelease failed with exit code 1.`
When I update in an Android project Gradle to 6.2.2 from 6.1.1 I run into this non-understandable error.
> Configure project :commonLib
The BuildListener.buildStarted(Gradle) method has been deprecated. This is scheduled to be removed in Gradle 7.0. Consult the upgrading guide for further information: https://docs.gradle.org/6.2.2/userguide/upgrading_version_5.html#apis_buildlistener_buildstarted_and_gradle_buildstarted_have_been_deprecated
at build_bpg7owlpe9pidz38268q3rf54.run(/builds/cross/mxtracks/commonLib/build.gradle:1)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
Internal API constructor DefaultDomainObjectSet(Class<T>) has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use ObjectFactory.domainObjectSet(Class<T>) instead. See https://docs.gradle.org/6.2.2/userguide/custom_gradle_types.html#domainobjectset for more details.
at build_bpg7owlpe9pidz38268q3rf54.run(/builds/cross/mxtracks/commonLib/build.gradle:1)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
> Configure project :MXApp
Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':MXApp'.
> Failed to notify project evaluation listener.
> java.lang.NoSuchMethodError: org.gradle.util.DeprecationLogger.nagUserWith(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
> KotlinJvmAndroidCompilation with name 'paidRelease' not found.
* 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 1m 3s
I'm out of ideas, even
defaultConfig {
...
android.ndkVersion '21.0.6113669'
}
shows the same result. Maybe someone can help ?
I found the reason, running the gradle task with --stacktrace helps me to find the reason.
It was gradle-play-publisher and this release 2.7.5 solved it finally