When trying to run react-native run-android I am getting this error:
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> java.lang.NullPointerException (no error message)
I just updated my OS to El Capitan 10.11.6. It was working fine this morning so I am just wondering what could be wrong.
Modifying the client.js to add the --stacktrace flag to the gradle command doesn't help.
It looks like the package I was requiring as a dependency was trying to also include firebase that is really big. By narrowing down to the exact packages I needed and only those, I was able to have the build to pass successfully.
Related
I am working on a react native application. when I try to build the applications using react-native run-android the build fails. Here is the output of the error that occurs.
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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 8s
253 actionable tasks: 5 executed, 248 up-to-date
error 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
error Command failed: ./gradlew app:installDebug
debug Error: Command failed: ./gradlew app:installDebug
at checkExecSyncError (child_process.js:607:13)
at execFileSync (child_process.js:627:13)
at runOnAllDevices (/Users/FaisalHussain/mobile/node_modules/#react-native-community/cli/build/commands/runAndroid/runOnAllDevices.js:58:39)
at buildAndRun (/Users/FaisalHussain/mobile/node_modules/#react-native-community/cli/build/commands/runAndroid/runAndroid.js:142:41)
at then.result (/Users/FaisalHussain/mobile/node_modules/#react-native-community/cli/build/commands/runAndroid/runAndroid.js:104:12)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
The application was on a old version of react native (0.48.x) I have updated it to 0.59.10.
What I have done so far:
used jetifier to resolve issues with the plugins.
checked that the build tools version matches the compile sdk version
checked if the emulator is running.
Hence I have tried everything I could to resolve this but had no luck. Please do guide me on how to resolve this issue. Looking forward to your answers.
make sure you have followed all the necessary steps from the upgrade helper https://react-native-community.github.io/upgrade-helper/?from=0.48.0&to=0.59.10
also i would suggest you to upgrade to v0.60+ because there are breaking changes after v0.59.10.
having said that
before you run the app make sure your gradle is clean
run the following command to clean your gradle cd android && ./gradle clean
then later you can navigate back to your app folder cd .. and try and run again react-native run-android
Looks like your packages not working stable with Android side. It's better be update all packages and react native version to their last stable versions.
If you face with too much error while update, you can create fresh new react native project (with same package name with your current project), install all packages (and their dependencies) and copy your current project's source code to your new project.
Android in React Native does not allow similar packages to reside in the project.
In my case I had react-native-cookies and #react-native-cookies/cookies packages that add similar code to the Kotlin file upon build. This causes issue of similar imports in java JDK.
I removed one and it worked.
SOLVED at the same issue:
My solution was at /android/build.gradle file.
Somehow, the buildscript versions were wrong.
Follow the exact same step of RN documentation and make a totally new & clean project.
And compate the /android/build.gradle file > buildscript & dependencies part.
There should be some version differences.
It matters by your own local env settings.
After changing buildToolsVersion, ndkVersion, classpath, it worked fine again!!
also, remove duplicated libraries, as #Nimantha said.
Build apk failed in Travis CI. But sometimes it can build successfully, especially in night. I'm not sure it is a network error or other reasons.
SEVERE: APKit-AdkInstrumentor(1): extracting the apk failed rc = 1
Throwable occurred: aC: extracting the apk failed rc = 1
at aG.a(SourceFile:199)
at aG.a(SourceFile:155)
at aG.a(SourceFile:150)
at v.a(SourceFile:142)
at e.f(SourceFile:181)
at e.<init>(SourceFile:88)
at a.<init>(SourceFile:27)
at com.dynatrace.android.instrumentation.AdkInstrumentor.c(SourceFile:337)
at com.dynatrace.android.instrumentation.AdkInstrumentor.main(SourceFile:277)
Instrumentation failed
Task :mobile:autoInstrumentStagUnpinnedRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':mobile:autoInstrumentStagUnpinnedRelease'.
Process 'command '/home/travis/build/app-android/mobile/build/tmp/prepareApkit/dynatrace-mobile-agent-android-7.2.4.1262/Android/auto-instrumentor/instrument.sh'' finished with non-zero exit value 5
if you are sure the build is working fine sometimes, I think it may be related to the third party of the application ( I think you want to make sure the Dynatrace Gradle plugin, you should clean and sync your project works successfully then check with Travis-ci configuration)
also, need to check does Travis-ci support this kind of application related to third-party applications
as seen from the link
https://answers.dynatrace.com/questions/213065/auto-instrument-apk-failed.html
You are still using the auto-instrumentor version 7.1.10.2332. If you are using the Dynatrace Gradle plugin, you should clean and sync your project. This behavior should force Android Studio to use the new plugin version.
To troubleshoot your problem we need the full log file. The problem occurs in a 3rd party tool and the root cause is not visible in the stack trace.
I'm trying to create automatic tests for my flutter project and I'm using codemagic for this. https://codemagic.io Anyways, everything works fine on my local machine; however, when I try to run it on codemagic it fails on installing dependencies. Here's part of the output for where it's failing:
FAILURE: Build failed with an exception.
* Where:
Script '/Users/builder/programs/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 200
* What went wrong:
A problem occurred configuring project ':path_provider'.
> Failed to notify project evaluation listener.
> Could not get unknown property 'android' for project ':path_provider' of type org.gradle.api.Project.
> Could not find method debugProvided() for arguments [file collection] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I've done some searching related to these errors. I'm seeing a few possible solutions such as upgrading gradle version and make a few adjustments in my files. However, none of the problems pertain to my problem (codemagic) and the solutions generally aren't working. The solutions I was following was they were running on their local machine and they get the error. Mine works locally, but not on the cloud testing environment. Any ideas? (Let me know if there are certain files I should post) Thanks!
I have recently ejected my expo app using expo eject.
I have now tried to build using AppCenter, it gets about 4 minutes in and then fails with the following error message.
FAILURE: Build failed with an exception.
What went wrong: Task 'assembleDevKernelDebug' not found in project ':app'.
Can anyone point me in the right direction of how to fix this?
My android folder looks like this
My build.gradle looks like this
I installed Android Studio version 3.2.1 on Windows 10. My Gradle doesn't build after trying for around 2 days. I have a problem that I don't understand. When I run the program, execution fails for task :compileDebugJavaWithJavac. What can I do?
try command "gradlew assembleDebug -is" in your IDE terminal, it will tell you where your code error occurred. BTW, javac task error means your code cannot pass java compiler ,and your picture showed the errors , such as " cannot find symbol class R..."