On a new project,
$ create-react-native-app crna-test
$ cd crna-test
$ npm run eject # default selections chosen
$ npm install
$ react-native run-android
fails with an error message
A problem occurred configuring project ':app'.
> java.lang.NullPointerException (no error message)
$ react-native run-android should run successfully on a new project
$ cd android/
$ ./gradlew build --debug
gives this output (truncated to the error point)
16:17:09.777 [DEBUG] [com.android.build.gradle.internal.pipeline.TransformManager] InputStream: OriginalStream{jarFiles=[], folders=[], scopes=[SUB_PROJECTS], contentTypes=[CLASSES], dependencies=[prepareDebugDependencies, build dependencies configuration ':app:_debugApk' all dependencies]}
16:17:09.777 [DEBUG] [com.android.build.gradle.internal.pipeline.TransformManager] InputStream: OriginalStream{jarFiles=[], folders=[], scopes=[SUB_PROJECTS_LOCAL_DEPS], contentTypes=[CLASSES], dependencies=[prepareDebugDependencies, build dependencies configuration ':app:_debugApk' all dependencies]}
16:17:09.777 [DEBUG] [com.android.build.gradle.internal.pipeline.TransformManager] InputStream: OriginalStream{jarFiles=[], folders=[/Users/noel/w/crna-test/android/app/build/intermediates/classes/debug], scopes=[PROJECT], contentTypes=[CLASSES], dependencies=[compileDebugJavaWithJavac]}
16:17:09.777 [DEBUG] [com.android.build.gradle.internal.pipeline.TransformManager] OutputStream: IntermediateStream{rootLocation=/Users/noel/w/crna-test/android/app/build/intermediates/transforms/dex/debug, scopes=[PROJECT, PROJECT_LOCAL_DEPS, SUB_PROJECTS, SUB_PROJECTS_LOCAL_DEPS, EXTERNAL_LIBRARIES], contentTypes=[DEX], dependencies=[transformClassesWithDexForDebug]}
16:17:09.778 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Registering model element 'tasks.transformClassesWithDexForDebug' (hidden = false)
16:17:09.793 [ERROR] [org.gradle.BuildExceptionReporter]
16:17:09.793 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
16:17:09.793 [ERROR] [org.gradle.BuildExceptionReporter]
16:17:09.793 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
16:17:09.793 [ERROR] [org.gradle.BuildExceptionReporter] A problem occurred configuring project ':app'.
16:17:09.793 [ERROR] [org.gradle.BuildExceptionReporter] > java.lang.NullPointerException (no error message)
16:17:09.793 [ERROR] [org.gradle.BuildExceptionReporter]
16:17:09.793 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
16:17:09.793 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
16:17:09.795 [LIFECYCLE] [org.gradle.BuildResultLogger]
16:17:09.795 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
16:17:09.795 [LIFECYCLE] [org.gradle.BuildResultLogger]
16:17:09.795 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 6.915 secs
Please run these commands in the project folder and fill in their results:
npm ls react-native-scripts: (empty)npm ls react-native: [email protected]npm ls expo: (empty)node -v: v8.3.0npm -v: 5.6.0yarn --version: 0.21.3watchman version: "version": "4.7.0"Also specify:
@noelweichbrodt downgrade npm to 4.x, 'cause npm 5.x isn't supported yet.
npm i -g [email protected]
I have been experiencing the same problem since I created a new project. I use npm 4.6.1
HELP PLEASE
This is due to a newer Java compiler version. Use version 10 instead of 8. On mac, try javac --version and downgrade to 8.