Gradle failed while building the flutter project - android

below is the exception which I have found while building the flutter project (Clone from GitLab).
Launching lib\main.dart on A37fw in debug mode...
Running Gradle task 'assembleDebug'...
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
error: warnings found and -Werror specified
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':connectivity: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 21m 31s
Exception: Gradle task assembleDebug failed with exit code 1

I've solved my problem by downgrade my jdk version to 14 to 11.

Related

Flutter-how to solve thisin flutter?

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

react-native run-android failed M1

~/RNSTAMPY  react-native run-android  1 ✘ ╱ took 41s ╱ at 10:24:15 PM
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
(node:4459) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
Jetifier found 1119 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
Task :app:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
93 actionable tasks: 2 executed, 91 up-to-date
/Users/leeseungsup/RNSTAMPY/android/app/src/main/java/com/rnstampy/MainActivity.java:2: error: class, interface, or enum expected
package com.rnstampy;
^
1 error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app: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 3s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/leeseungsup/RNSTAMPY/android/app/src/main/java/com/rnstampy/MainActivity.java:2: error: class, interface, or enum expected
package com.rnstampy;
^
1 error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app: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 3s
at makeError (/Users/leeseungsup/RNSTAMPY/node_modules/#react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
at /Users/leeseungsup/RNSTAMPY/node_modules/#react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/leeseungsup/RNSTAMPY/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/leeseungsup/RNSTAMPY/node_modules/#react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
run-ios is ok
run-android => android emulator opens but can't install my app.
When I ran android emulator in EXPO cli, it worked well!
but in react-native-cli environment, it doesn't work!!
react-native-cli: 2.0.1
react-native: 0.69.3
please help me~~
I solved my problem.
/Users/leeseungsup/RNSTAMPY/android/app/src/main/java/com/rnstampy/MainActivity.java:2: error: class, interface, or enum expected package com.rnstampy; ^ 1 error
this was my problem.
I moved [package com.rnstampy;] on the TOP. that's all.
It worked.

plain_notification_token failed to Compile in Flutter

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

Flutter Project getting

Launching lib/main.dart on Redmi 4 in debug mode...
Running Gradle task 'assembleDebug'...
Note: /Users/mac/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-11.2.4/android/src/main/java/io/flutter/plugins/firebase/messaging/JobIntentService.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/mac/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_share-2.0.0/android/src/main/java/com/example/fluttershare/FlutterSharePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/Users/mac/Desktop/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 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 39s
Exception: Gradle task assembleDebug failed with exit code 1
I am getting this issue on my project since 2 days, I have tried every solution provided in the google or stack overflow please help me out with this issue.
type
flutter clean
on your integrated terminal , and build again.

Error while executing process "cmake\3.6.4111459\bin\cmake.exe" with arguments

I am getting below error, When I try to clean my Android NDK project
12:41:28: Executing task 'clean'...
Executing tasks: [clean]
Task :app:externalNativeBuildCleanDebug FAILED
Clean NextGenJNIWrapperExample armeabi-v7a
ninja: error: loading 'build.ninja': The system cannot find the file specified.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:externalNativeBuildCleanDebug'.
Build command failed.
Error while executing process D:\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build D:\ssl\NGC\NextGenConsole\app.externalNativeBuild\cmake\debug\armeabi-v7a --target clean}
ninja: error: loading 'build.ninja': The system cannot find the file specified.
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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 0s
1 actionable task: 1 executed
12:41:29: Task execution finished 'clean'.
I had same issue and i fixed it
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
version "3.10.2" // just add current installed version of CMake
}
}

Categories

Resources