FAILURE: Build failed with an exception. app:compileDebugJavaWithJavac - java

I am trying to compile/build a react native application
-->installed node.js(with npm) , openjdk11, android studio
-->during build process facing this error.
-->all the env variables are set properly, ANDROID_HOME,JAVA_HOME, java bin ......
Not sure how to resolve this. Need some help

Related

How to add dependency in react-native plugin for iOS?

I'm created plugin using this command
npx create-react-native-library react-native-randomness
I write code for ios is it in <root_dir>/ios and add pod dependencies there.
But when I build the project I got this error.
** BUILD FAILED **
The following build commands failed:
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'react-native-awesome-module' from project 'Pods')
(1 failure)
Any help would be appreciated.

React Native Splash Screen Issue - after modifying xml files in android folder

I would like to create a splash screen in my React Native app (not Expo) using Android Studio's emulator.
I was trying to add a splash_screen.xml file into android/app/src/main/res/drawable folder. When I put a new .xml file into the android folder the React compiler shows the following error message:
iMac:newtest Dora$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Configure project :app
WARNING: The specified Android SDK Build Tools version (28.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '28.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Task :app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugResources'.
com.android.build.gradle.tasks.ResourceException (no error message)
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 2s
9 actionable tasks: 1 executed, 8 up-to-date
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Command failed: ./gradlew installDebug
Error: Command failed: ./gradlew installDebug
at checkExecSyncError (child_process.js:637:11)
at Object.execFileSync (child_process.js:655:13)
at runOnAllDevices (/Users/Dora/Documents/code/react native/newtest/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19)
at buildAndRun (/Users/Dora/Documents/code/react native/newtest/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12)
at isPackagerRunning.then.result (/Users/Dora/Documents/code/react native/newtest/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12)
at processTicksAndRejections (internal/process/next_tick.js:81:5)
Thank you for taking your time to help me to solve this issue!
Cheers,
Alex
Well, finally I have managed to solve this issue. It is for those who will encounter this problem during Android development.
So, what i did exactly:
1. cd into android folder and run this: ./gradlew installDebug
After this command finished without any errors
go back to the root directory and start the app using: react-native run-android
Conclusion, if you add or change any xml files in android folder, you have to do the above procedure.
That's all!
Alex

React-Native build release apk Failed to execute aapt

App works in debug mode just fine by running react-native run-android
But, when I try to build in relase mode by running cd android && ./gradlew assembleRelease
it gives me this error:
android\app\build\intermediates\res\merged\release\drawable-hdpi\node_modules_reactnavigation_src_views_assets_backicon.png: error: uncompiled PNG file passed as argument. Must be compiled first into .flat file..
error: failed parsing overlays.
Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
I tried workarounds like putting android.enableAapt2=false and org.gradle.configureondemand=true in android/gradle.properties
They both helped me create signed apk but app was crashing on start,
I tried to debug that crash by adb logcat and error is:
FATAL EXCEPTION: Thread-139
java.lang.RuntimeException: Unable to load script from assets 'index.android.bundle'. Make sure your bundle is packaged correctly or you're running a packager server.
Please help me out, I cant seem to figure out how to solve this.
if anyone wonders, we ended up downgrading gradle to
classpath 'com.android.tools.build:gradle:2.2.3'
and it worked.

Getting issues with ADB for react-native run-android

I've been trying to follow the react-native tutorial on udemy, but I've been having trouble getting started: When I try to run the react-native run-android, I've been getting this error:
app:installDebug FAILEDnstallDebug
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: Could not create ADB Bridge.
ADB location: C:\Users\(USERNAME)\AppData\Local\Android\Sdk\platform-tools\adb.exe
I've been using the latest android studio client; I have been using an emulator to simulate a Google Nexus 5, and using the java version that is compatible for the project (the latest, 9.0.9, has been causing problems). I have no familiarity with Genymotion, as it has not been mentioned in the class or is said to be a necessary application; any solutions involving this has not been of any use so far.
Thanks for reading.

Android app with Oracle MAF, build.xml not found

I'm currently developing an Android (API 21) app on Eclipse OEPE (Mars) using a 64-bit Win7. The SDK was downloaded and installed by Android Studio (with all the platform-tools and build-tools). I have had no trouble writing the app, but as soon as I try to debug it as described here (Step 6), I get the following error:
BUILD FAILED
{WorkspacePath}\HelloWorld\.main.android.1\bin\build.xml:3: The following error occurred while executing this line:
{WorkspacePath}\HelloWorld\.main.android.1\bin\build-set-globals.xml:67: Cannot find C:\AndroidSdk\tools\ant\build.xml imported from {WorkspacePath}\HelloWorld\.main.android.1\bin\build-set-globals.xml
Total time: 895 milliseconds
(I'm the one who replaced the path to the workspace with {WorkspacePath}).
I have no idea what's going on and couldn't find anything on internet; any suggestion?
EDIT: I forgot to mention it, but the thing that is bothering me the most is that there's no "ant" folder in {SDKPath}/tools

Categories