Execution error while building android phone gap build - android

when i Run the command phonegap build android it gives me the the error execution failed for task 'mergeDebugResources' I am implementing the plugin cordova-background-geolocation-lt and following the same as explained there and install the same SDK's.
complete error
Here is some more info about DEBUG after running the command gradlew.bat --info build clean

I think this is a clash with some other plugin. I have tried adding the diagnostic plugin to a brand new project and tried building. That worked fine.

Related

How to solve the error FAILURE: Build failed with an exception. * Where: Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005

I'm trying to run the application in the android emulator but this error keeps popping.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\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 33s
Exception: Gradle task assembleDebug failed with exit code 1
I have tried the following with no help.
flutter channel stable
flutter upgrade --force
flutter pub cache repair
flutter clean
in case anyone can help.
Try this:
Close project.
Go to project repository folder.
Delete all generated files, for example:
.dart_tool
.idea
.build
.flutter-plugins
.flutter-plugins-dependencies
.metadata
.packages
Nothing should changed in your git changes due to .gitignore file
Open Android Studio again
Go to File->Invalidate Caches/Restart, then invalidate caches and restart
if your project structure is corrupted go to: File -> Close Project, close project and reopen it, it should be back to normal.
Run all the necessary scripts starting with:
flutter pub get
dart pub get
For me the thing was to delete android/app/build folder and run flutter clean.
I had this problem in (line 1156) when I wanted to build an APK file, after almost executing solutions to solve it, finally found this command
build release apk:
flutter build apk --release --no-tree-shake-icons
build apk with the lowest size:
flutter build apk --split-per-abi --no-tree-shake-icons
I could build my APK very well
2022 Working Solution
I got the same error after running my app on a physical device. This may happen if the compile SDK version is lower than that of the physical device. This error message is not limited just to running on physical devices however, here is the solution.
Go to android/app/build.grade
Find
android {
compileSdkVersion 30 //Or whatever version it currently is
The change the compileSdkVersion to 31
android {
compileSdkVersion 31
In the future, the maximum compileSdkVersion might increase, so try 32, or 33 if it doesn't work
upgrade your dependencies in your pubspec.yaml
Working solution:
Just uninstall/remove the entire flutter SDK folder and reinstall the same version of a flutter you have currently from the below link.
Flutter SDK as per version: https://flutter.dev/docs/development/tools/sdk/releases?tab=macos
After the new flutter is installed. Just do flutter clean and run the app.
For my case, I found my code incompatible with my flutter version as I used flutter upgrade once. So I had to downgrade (delete the flutter folder manually in your src folder and extract the version that supports my code) my flutter sdk in C:\src\flutter to the version that my app supports. After running flutter clean (which just deletes the files that flashrow has mentioned) it got solved for me.
Try to run with the -v parameter to see a better logging console. In my case, some plugins are generating the following error:
Cannot run with sound null safety, because the following dependencies
When I saw it, I run with the option --no-sound-null-safety and I could start my app in the emulator.
Apperently this seems like a null safety related issue.
lowering down the Dart sdk's version from pubspec.yaml could solve this issue.
flutter channel stable
flutter upgrade
## pubspec.yaml
environment:<br>
sdk: '>=2.0.0 <3.0.0'

react-native-vector-icons causing issues with android build

I am having an extremely difficult time trying to get react-native run-android to work on my mac so that my react-native android project runs in an emulator. The command runs fine on my windows machine.
This is the error I'm getting:
Configure project :react-native-vector-icons The CompileOptions.bootClasspath property has been deprecated and is
scheduled to be removed in Gradle 5.0. Please use the
CompileOptions.bootstrapClasspath property instead.
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugApk'.
A problem occurred configuring project ':react-native-vector-icons'.
Failed to notify project evaluation listener.
com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)V
In my Android Studio, I am using the Virtual Device Pixel API 26, API = 26, Target = Android 8.0 (Google APIs).
Here are the SDK Platforms I've selected:
For the SDK Tools, I selected 23.0.1,26.0.1,26.0.2,27.0.1.
How do I get react-native run-android to make the app show in my emulator?
Try commenting out all references to react-native-vector-icons and see if your project runs without
Try getting a newer version of react-native-vector-icons
Try running react-native run-android --info --scan and if you can, approve and then paste the approved scan link in an update to your question.

Run "Instant Run" from command line

I'm running my Android app from Android Studio, and Instant Run kicks in, which is great. I want to run the exact same thing from the command-line.
In Android Studio's Event Log, I see
22:00:28 Executing tasks: [:app:incrementalDevDebugSupportDex]
22:00:48 Gradle build finished in 20s 286ms
22:00:51 Instant Run applied code changes and restarted the current Activity.
So, I expected I would be able to run that task from the command line: ./gradlew :app:incrementalDevDebugSupportDex. However, it's not found:
FAILURE: Build failed with an exception.
* What went wrong:
Task 'incrementalDevDebugSupportDex' not found in project ':app'.
Is there a way to run with Instant Run from the command line?
It is currently not possible to use instant run outside of Android Studio. This was mentioned at the Android Dev Summit, but I can't recall exactly in which talk that was.
You can run instant-run from command line like this:
./gradlew clean :sample-app:assembleDebug -Pandroid.optional.compilation=INSTANT_DEV -Pandroid.injected.build.api=24
As of now it is possible. You can run the below command to make an instant run :
./gradlew :app:incremental"buildvarientname"DebugJavaCompilationSafeguard
You can add the same in gradle task also by adding incremental"buildvarientname"DebugJavaCompilationSafeguard inside the task on the run configuration window,

Error while importing ionic/cordova project to Android studio

I just started working on Ionic framework and created a project using CLI. I have added support for android platform generated an android project using the following command:
ionic platform add android
This has been done successfully, Now i am importing tha android project to android studio but getting the following error related with gradle.
FAILURE: Build failed with an exception.
* What went wrong:
Task '' not found in root project 'android'.
* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Following are the contents of build.gradle file available in cordovaLib folder
So if am i missing something while importing project or build.gradle needs to be updated?
I figured out the thing that was going wrong. I imported the ionic project that i created from CLI to Android studio.
There i got two seperate build.gradle files in ionic project. One was in the root android project and other one was in CordovaLib project. In both the gradle files buildToolVersion was being identified at the run time. So may be Android Studio was unable to resolve the build version.
Setting hardcoded build version to "19.1" and SDK version to 21 fixed the issue.

Ionic Run Faild

I can run my ionic project on android device perfectly until now but now this error is happens. I did not change anything in project structure.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_armv7DebugCompile'.
> Could not find any version that matches org.xwalk:xwalk_core_library_beta:13+.
Searched in the following locations:
https://repo1.maven.org/maven2/org/xwalk/xwalk_core_library_beta/maven-metadata.xml
https://repo1.maven.org/maven2/org/xwalk/xwalk_core_library_beta/
https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library_beta/maven-metadata.xml
file:/Applications/android-sdk/extras/android/m2repository/org/xwalk/xwalk_core_library_beta/maven-metadata.xml
file:/Applications/android-sdk/extras/android/m2repository/org/xwalk/xwalk_core_library_beta/
file:/Applications/android-sdk/extras/google/m2repository/org/xwalk/xwalk_core_library_beta/maven-metadata.xml
file:/Applications/android-sdk/extras/google/m2repository/org/xwalk/xwalk_core_library_beta/
Required by:
:android:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 20.525 secs
/Users/myuser/Projects/appname/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/myuser/Projects/appname/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/myuser/Projects/appname/platforms/android/build.gradle,-PcdvBuildArch=x86,-Dorg.gradle.daemon=true
I removed android platform and all node_modules and added them again but still i see this error.
i can serve my app and run on IOS simulator perfectly.
I had the same problem!
I solved it with the following steps:
Remove browser with ionic browser revert android
Install crosswalk again ionic browser add crosswalk
Deploy aplication ionic run android
I had same problem, on run time I used VPN in ionic build android and Ionic run android command. this will help to reach the website to download components.
Also about the maven
I run CMD command with "Run as Administrator" it started to download maven and after that it works fine for me.
Before this I used to upgrade JDK and JRE but has not change in result.
I have upgraded Windows 7 to Windows 10 directly and some times applications needs to start by using "Run As administrator"
I have found the solution for the problem using the google play service and Google Repository in android SDK
Please install the following dependency using android SDK manager Google Play services and Google Repository
Once the installation is completed then you create your project and run.
Now it should work fine

Categories

Resources