I'm trying to build an ionic app for Android but when I run
ionic cordova run android
I get
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: java.lang.IllegalStateException: Dex archives: setting .DEX extension only for .CLASS files
Trying to run ./gradlew clean gets me
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type FileHasher using BuildSessionScopeServices.createFileSnapshotter().
I had the same issue but it was resolved. Thanks to information from #notlose at this link https://github.com/oney/react-native-gcm-android/issues/32
Solution:
just remove both 'build' folder in /android and /android/app
and build again with
'react-native run-android' for react-native
'ionic cordova run android' for ionic
Related
I'm trying to build my react-native app for android. I can build it for iOS without any problem, but I'm having problems with Android.
When I do ./gradlew assembleDebug inside the android folder to generate an apk I receive the following error:
Task :generateDebugBuildConfig FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':generateDebugBuildConfig'.
> Error while evaluating property 'buildConfigPackageName' of task ':generateDebugBuildConfig'
> Failed to calculate the value of task ':generateDebugBuildConfig' property 'buildConfigPackageName'.
> Failed to query the value of property 'packageName'.
> Manifest file does not exist: /Users/user/Desktop/app_name/app_name/android/src/main/AndroidManifest.xml
My AndroidManifest is not present at that path, but in the following path:
/Users/user/Desktop/app_name/app_name/android/app/src/main/AndroidManifest.xml
I know maybe it's a stupid question, but how do I change the location where to search the AndroidManifest?
I followed the instructions to import OpenCV to Android Studio here https://github.com/quickbirdstudios/opencv-android, after Android Studio wouldn't let me use the File > New > Import Module feature. After following the instructions, I get these build errors:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
com.android.manifmerger.ManifestMerger2$MergeFailureException: java.io.FileNotFoundException: H:\AndroidProjects\WyzeCloud\Rev1\IPCloud\app\build\intermediates\navigation_json\debug\navigation.json (The system cannot find the file specified)
============================================================================
2: Task failed with an exception.
What went wrong:
Execution failed for task ':app:compressDebugAssets'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CompressAssetsWorkAction
H:\AndroidProjects\WyzeCloud\Rev1\IPCloud\app\build\intermediates\merged_assets\debug\out
============================================================================
BUILD FAILED in 18s
Anyone know what these errors mean, or have a possible solution to importing OpenCV to an Android Studio project?
I faced this problem before and my solution:
Download the Android sdk of Open-CV from this link: https://opencv.org/releases/
Add the java and jni library files into your project. Java functions of this library is works with jni files (.so).
I install react native reanimated 2 according to its installation doc. But when I run project for android build, I get this error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
> 2 files found with path 'lib/x86_64/libreactnativejni.so' from inputs:
- D:\ReactBootCamp_RASAHR\Bootcamp Main Projects\ReactNative\SecondVersion\Fooductor\node_modules\react-native-reanimated\android\build\.transforms\1ebd6d22f25011a79a18acd12f297fc9\transformed\jetified-react-native-reanimated-65-hermes\jni
- C:\Users\Kavosh\.gradle\caches\transforms-3\156e8e6ad84734ffd5fbff137e92dae0\transformed\jetified-react-native-0.65.1\jni
If you are using jniLibs and CMake IMPORTED targets, see
https://developer.android.com/r/tools/jniLibs-vs-imported-targets
How can I solve this?
There is an error while run project on windows for android. Everything was good but I installed react-natigation and react-native-gesture-handler#~1.0.14 than I started project with react-native run-android command.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Could not read path 'D:\ProjectFolder\android\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\androidx\lifecycle'.
I solved my problem. If somebody need this, remove react-navigation and install #react-navigation/native
I have the error:
:react-native-i18n:processReleaseResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-i18n:processReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
When I want to generate my application from react-native use my Jenkinsfile script.
dir('src/Mobile/android'){
sh 'chmod +x ./gradlew'
sh 'ANDROID_HOME=/home/user/android ./gradlew assembleDefault'
archive '*/build/outputs/apk/*.apk'
I can run the application in the local environment but my server with Jenkins can't build my App. Any idea how to solve this problem?