:app:compileDebugUnitTestJavaWithJavac FAILED Android Studio - java

I have searched to a good degree on stack overflow etc to try find an answer to my question. I have so far been unable to find any solution that works for my specific problem.
Up until the 5th of February, When I ran the command:
.\gradlew test
The command would complete and the build would be successful. Today (7th), I pulled changes from my teams remote repo. When I ran the command I would get the below output:
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareComJourneyappsZxingAndroidEmbedded310Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies
:app:compileDebugUnitTestJavaWithJavac FAILED
BUILD FAILED
Total time: 5.804 secs
I created a new branch to see if I could figure out what commit was causing the issue, however, when I checked out a commit that I knew for certain did not contain issues (the commit I had previously been at) and attempted to run the command I would get similar output.
Similarly I used to be able to simply right click on my test file and select "Run whateverTest.java" and the test would run.
Now when I attempt the same thing I get the following output:
!!! JUnit version 3.8 or later expected:
java.lang.RuntimeException: Stub!
at junit.runner.BaseTestRunner.<init>(BaseTestRunner.java:5)
at junit.textui.TestRunner.<init>(TestRunner.java:54)
at junit.textui.TestRunner.<init>(TestRunner.java:48)
at junit.textui.TestRunner.<init>(TestRunner.java:41)
at com.intellij.rt.execution.junit.JUnitStarter.junitVersionChecks(JUnitStarter.java:191)
at com.intellij.rt.execution.junit.JUnitStarter.canWorkWithJUnitVersion(JUnitStarter.java:174)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Process finished with exit code -3
Now I must select the file and select "Run..." from the run tile. This will run my tests successfully.
I have attempted the ususal build, clean restart computer etc. I have also attempted to create a JAVA_HOME and ANDROID_JAVA_HOME environment variable (under recommendation of similar questions).
Since that time the only thing that sticks out to me is that there was a java update. I suspect this may be the cause but I am not certain.
I would appreciate any help and I can provide any more details that are required.
Thanks.
UPDATE
For more context here is more of the output from .\gradlew test
* What went wrong:
Execution failed for task ':app:compileDebugUnitTestJavaWithJavac'.
> Could not find tools.jar
Hopefully this gives better context.

SOLVED
Problem was solved by uninstalling both Java and Android Studio and then reinstalling them.
I believe there was a path hidden somewhere in Android Studio that I was unable to change that took a reinstall for me to be prompted to select.

Related

Process 'command '/Applications/Android Studio 3.0.1.app/Contents/jre/jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

I came across a problem when i used android studio to import a project.More details below :
```
Error:Execution failed for task ':app:transformClassesWithDexForArmDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
```
And the Gradle console show the following message:
---------
Executing tasks: [:app:assembleArmDebug]
Configuration on demand is an incubating feature.
:app:copyJniLibsArmDebugMainJniLibs UP-TO-DATE
:app:armDebug UP-TO-DATE
:app:preBuild UP-TO-DATE
:app:preArmDebugBuild UP-TO-DATE
:app:checkArmDebugManifest
:app:preArmReleaseBuild UP-TO-DATE
:app:prepareCjtLibraryWheelCamera019Library UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2531Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72531Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72531Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2531Library UP-TO-DATE
:app:preArmDebugAndroidTestBuild UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72531Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCompat2531Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUi2531Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUtils2531Library UP-TO-DATE
:app:prepareComAndroidSupportSupportFragment2531Library UP-TO-DATE
:app:prepareComAndroidSupportSupportMediaCompat2531Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42531Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2531Library UP-TO-DATE
:app:prepareComAndroidSupportTransition2531Library UP-TO-DATE
:app:prepareComBlankjUtilcode134Library UP-TO-DATE
:app:prepareComCjjMaterialrefeshlayoutLibrary130Library UP-TO-DATE
:app:prepareComDaimajiaAndroidanimationsLibrary113Library UP-TO-DATE
:app:prepareComDaimajiaEasingLibrary101Library UP-TO-DATE
:app:prepareComDanikulaVideocache264Library UP-TO-DATE
:app:prepareComDevbracketsAndroidExomedia301Library UP-TO-DATE
:app:prepareComEdmodoCropper101Library UP-TO-DATE
:app:prepareComFlycoTablayoutFlycoTabLayout_Lib212Library UP-TO-DATE
:app:prepareComGetbaseFloatingactionbutton1101Library UP-TO-DATE
:app:prepareComGithubChrisbanesPhotoView130Library UP-TO-DATE
:app:prepareComGithubCtiaoDanmakuFlameMaster0912Library UP-TO-DATE
:app:prepareComGithubJmolsmobileLandscapevideocamera107Library UP-TO-DATE
:app:prepareComGithubSatyanSugar15Library UP-TO-DATE
:app:prepareComGoogleAndroidExoplayerExoplayerR159Library UP-TO-DATE
:app:prepareComJaydenxiaoGuider100Library UP-TO-DATE
:app:prepareComJcodecraeerXrecyclerview132Library UP-TO-DATE
:app:prepareComMakeramenRoundedimageview230Library UP-TO-DATE
:app:prepareComMalinskiySuperrecyclerview114Library UP-TO-DATE
:app:prepareComOrhanobutLogger115Library UP-TO-DATE
:app:prepareComPgyersdkSdk254Library UP-TO-DATE
:app:prepareComPingxxPingppAlipay218Library UP-TO-DATE
:app:prepareComPingxxPingppCore218Library UP-TO-DATE
:app:prepareComPingxxPingppWxpay218Library UP-TO-DATE
:app:prepareComRengwuxianMaterialedittextLibrary214Library UP-TO-DATE
:app:prepareComScwangSmartrefreshSmartRefreshHeader103Library UP-TO-DATE
:app:prepareComScwangSmartrefreshSmartRefreshLayout103Library UP-TO-DATE
:app:prepareComSerenegiantCommon119Library UP-TO-DATE
:app:prepareComZhyOkhttputils262Library UP-TO-DATE
:app:prepareDeHdodenhofCircleimageview210Library UP-TO-DATE
:app:prepareJpWasabeefGlideTransformations202Library UP-TO-DATE
:app:preparePubDevrelEasypermissions020Library UP-TO-DATE
:app:prepareArmDebugDependencies
:app:compileArmDebugAidl UP-TO-DATE
:app:compileArmDebugRenderscript UP-TO-DATE
:app:generateArmDebugBuildConfig UP-TO-DATE
:app:generateArmDebugAssets UP-TO-DATE
:app:mergeArmDebugAssets UP-TO-DATE
:app:generateArmDebugResValues UP-TO-DATE
:app:generateArmDebugResources UP-TO-DATE
:app:mergeArmDebugResources UP-TO-DATE
:app:processArmDebugManifest UP-TO-DATE
:app:processArmDebugResources UP-TO-DATE
:app:generateArmDebugSources UP-TO-DATE
:app:compileArmDebugJavaWithJavac UP-TO-DATE
:app:compileArmDebugSources UP-TO-DATE
:app:transformClassesWithJarMergingForArmDebug UP-TO-DATE
:app:collectArmDebugMultiDexComponents UP-TO-DATE
:app:transformClassesWithMultidexlistForArmDebug UP-TO-DATE
:app:transformClassesWithDexForArmDebug
PARSE ERROR:
unsupported class file version 52.0
...while parsing com/a/a/a.class
PARSE ERROR:
unsupported class file version 52.0
...while parsing com/a/a/b.class
2 errors; aborting
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithDexForArmDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java'' 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.
BUILD FAILED
Total time: 39.744 secs
This android project can run well on another computer, but it can't run on current one .I hope you can help me solve this problem or give me some suggestions, thanks in advance.
Try adding this code to build.gradle > android
dexOptions {
javaMaxHeapSize "4g"
}
This error is related to com.google.firebase and com.google.android.gms dependencies.
Upgrade them to their latest versions and the issue will be resolved.
Update your Project build.gradle with:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
and update all the com.google.firebase and com.google.android.gms in gradle file to newer version.
Maybe you make a new package in AndroidStudio with Camel case name. Sometimes make a crash and problem non-zero.
I just experienced the same issue. My fix was to:
"build > Clean project"
"build > Generate signed APK"
Then the build was succesful.
I had the dexOptions set as well in mij build.gradle file.
dexOptions {
javaMaxHeapSize "4g"
}

Nativescript + Genymotion : App not starting up on simulator - Execution failed for task ':buildMetadata'

Im running form the CLI
$ tns debug android --geny "Custom Phone - 5.0.0 - API21 - 768x1280" --debug-brk
Multiple devices found! Starting debugger on emulator. If you want to
debug on specific device please select device with --device option.
Executing before-prepare hook from
/Users/mohit/work/Mobile/native/Groceries/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 1.8.10 Project successfully prepared (android)
:config phase: createDefaultIncludeFiles +found plugins:
tns-core-modules-widgets
:config phase: createPluginsConfigFile Creating product flavors
include.gradle file in
/Users/mohit/work/Mobile/native/Groceries/platforms/android/configurations
folder...
:config phase: pluginExtend +applying configuration from:
/Users/mohit/work/Mobile/native/Groceries/platforms/android/configurations/include.gradle
+applying configuration from:
/Users/mohit/work/Mobile/native/Groceries/platforms/android/configurations/tns-core-modules-widgets/include.gradle
:config phase: copyAarDependencies
:config phase: addAarDependencies +adding dependency:
/Users/mohit/work/Mobile/native/Groceries/platforms/android/libs/aar/widgets-release.aar
Incremental java compilation is an incubating feature. :preBuild
UP-TO-DATE :preF0DebugBuild UP-TO-DATE :checkF0DebugManifest
:preF0ReleaseBuild UP-TO-DATE
:prepareComAndroidSupportAnimatedVectorDrawable2421Library UP-TO-DATE
:prepareComAndroidSupportAppcompatV72421Library UP-TO-DATE
:prepareComAndroidSupportSupportCompat2421Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUi2421Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUtils2421Library UP-TO-DATE
:prepareComAndroidSupportSupportFragment2421Library UP-TO-DATE
:prepareComAndroidSupportSupportMediaCompat2421Library UP-TO-DATE
:prepareComAndroidSupportSupportV42421Library UP-TO-DATE
:prepareComAndroidSupportSupportVectorDrawable2421Library UP-TO-DATE
:prepareGroceriesRuntimeUnspecifiedLibrary UP-TO-DATE
:prepareWidgetsReleaseLibrary UP-TO-DATE :prepareF0DebugDependencies
:compileF0DebugAidl UP-TO-DATE :compileF0DebugRenderscript UP-TO-DATE
:generateF0DebugBuildConfig UP-TO-DATE :cleanLocalAarFiles
:ensureMetadataOutDir :collectAllJars :setProperties
:asbg:generateInterfaceNamesList :asbg:runAstParser UP-TO-DATE
:asbg:generateBindings UP-TO-DATE :mergeF0DebugShaders UP-TO-DATE
:compileF0DebugShaders UP-TO-DATE :generateF0DebugAssets UP-TO-DATE
:mergeF0DebugAssets UP-TO-DATE :generateF0DebugResValues UP-TO-DATE
:generateF0DebugResources UP-TO-DATE :mergeF0DebugResources UP-TO-DATE
:processF0DebugManifest UP-TO-DATE :processF0DebugResources UP-TO-DATE
:generateF0DebugSources UP-TO-DATE
:incrementalF0DebugJavaCompilationSafeguard UP-TO-DATE
:compileF0DebugJavaWithJavac UP-TO-DATE :compileF0DebugNdk UP-TO-DATE
:compileF0DebugSources UP-TO-DATE :buildMetadata Exception in thread
"main" java.lang.IllegalArgumentException: Class
android.support.graphics.drawable.animated.BuildConfig conflict:
/Users/mohit/work/Mobile/native/Groceries/platforms/android/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/24.2.1/jars/classes.jar
and
/Users/mohit/work/Mobile/native/Groceries/platforms/android/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.4.0/jars/classes.jar
at com.telerik.metadata.ClassRepo.cacheJarFile(ClassRepo.java:21) at
com.telerik.metadata.Builder.build(Builder.java:39) at
com.telerik.metadata.Generator.main(Generator.java:44) :buildMetadata
FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':buildMetadata'.
Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/bin/java''
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.
BUILD FAILED
Total time: 11.293 secs Command
/Users/mohit/work/Mobile/native/Groceries/platforms/android/gradlew
failed with exit code 1
How do I fix this ?
Thanks :)
tns platform remove android
tns platform add android
https://github.com/NativeScript/android-runtime/issues/339

react-native run-android failed with error: Execution failed for task ':app:dexDebug'

I'm using windows 8.1. with
react-native-cli: 1.0.0 and
react-native: 0.31.0
After adding react-native-maps to the project, I ran command react-native upgrade and given Y to all questions.
Then linked deps with rnpm link as well as come changes to MainApplication.java file too.
Here are changes to MainApplication.java:
// Other imports ...
import com.airbnb.android.react.maps.MapsPackage;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
#Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
#Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new MapsPackage() // I have added this for react-native-maps
);
}
};
#Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}
Now I'm getting error when I run the command: react-native run-android
λ react-native run-android
JS server already running.
Running C:\Program Files (x86)\Android\android-sdk/platform-tools/adb reverse tcp:8081 tcp:808
1
Building and installing the app on the device (cd android && gradlew.bat installDebug...
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:react-native-maps:compileLint
:react-native-maps:copyReleaseLint UP-TO-DATE
:react-native-maps:preBuild UP-TO-DATE
:react-native-maps:preReleaseBuild UP-TO-DATE
:react-native-maps:checkReleaseManifest
:react-native-maps:preDebugAndroidTestBuild UP-TO-DATE
:react-native-maps:preDebugBuild UP-TO-DATE
:react-native-maps:preDebugUnitTestBuild UP-TO-DATE
:react-native-maps:preReleaseUnitTestBuild UP-TO-DATE
:react-native-maps:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:react-native-maps:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:react-native-maps:prepareComAndroidSupportSupportV42321Library UP-TO-DATE
:react-native-maps:prepareComFacebookFrescoDrawee0110Library UP-TO-DATE
:react-native-maps:prepareComFacebookFrescoFbcore0110Library UP-TO-DATE
:react-native-maps:prepareComFacebookFrescoFresco0110Library UP-TO-DATE
:react-native-maps:prepareComFacebookFrescoImagepipeline0110Library UP-TO-DATE
:react-native-maps:prepareComFacebookFrescoImagepipelineBase0110Library UP-TO-DATE
:react-native-maps:prepareComFacebookFrescoImagepipelineOkhttp30110Library UP-TO-DATE
:react-native-maps:prepareComFacebookReactReactNative0310Library UP-TO-DATE
:react-native-maps:prepareComFacebookSoloaderSoloader010Library UP-TO-DATE
:react-native-maps:prepareComGoogleAndroidGmsPlayServicesBase840Library UP-TO-DATE
:react-native-maps:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE
:react-native-maps:prepareComGoogleAndroidGmsPlayServicesMaps840Library UP-TO-DATE
:react-native-maps:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:react-native-maps:prepareReleaseDependencies
:react-native-maps:compileReleaseAidl UP-TO-DATE
:react-native-maps:compileReleaseRenderscript UP-TO-DATE
:react-native-maps:generateReleaseBuildConfig UP-TO-DATE
:react-native-maps:generateReleaseAssets UP-TO-DATE
:react-native-maps:mergeReleaseAssets UP-TO-DATE
:react-native-maps:generateReleaseResValues UP-TO-DATE
:react-native-maps:generateReleaseResources UP-TO-DATE
:react-native-maps:mergeReleaseResources UP-TO-DATE
:react-native-maps:processReleaseManifest UP-TO-DATE
:react-native-maps:processReleaseResources UP-TO-DATE
:react-native-maps:generateReleaseSources UP-TO-DATE
:react-native-maps:processReleaseJavaRes UP-TO-DATE
:react-native-maps:compileReleaseJavaWithJavac UP-TO-DATE
:react-native-maps:extractReleaseAnnotations UP-TO-DATE
:react-native-maps:mergeReleaseProguardFiles UP-TO-DATE
:react-native-maps:packageReleaseJar UP-TO-DATE
:react-native-maps:compileReleaseNdk UP-TO-DATE
:react-native-maps:packageReleaseJniLibs UP-TO-DATE
:react-native-maps:packageReleaseLocalJar UP-TO-DATE
:react-native-maps:packageReleaseRenderscript UP-TO-DATE
:react-native-maps:packageReleaseResources UP-TO-DATE
:react-native-maps:bundleRelease UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42321Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee0110Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore0110Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineBase0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp30110Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0310Library UP-TO-DATE
:app:prepareComFacebookSoloaderSoloader010Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps840Library UP-TO-DATE
:app:prepareNativeBaseDemoReactNativeMapsUnspecifiedLibrary UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug
Unknown source file : UNEXPECTED TOP-LEVEL EXCEPTION:
Unknown source file : com.android.dex.DexException: Multiple dex files define Landroid/support/v7/appcompat/R$anim;
Unknown source file : at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
Unknown source file : at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
Unknown source file : at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
Unknown source file : at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
Unknown source file : at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
Unknown source file : at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
Unknown source file : at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
Unknown source file : at com.android.dx.command.dexer.Main.run(Main.java:277)
Unknown source file : at com.android.dx.command.dexer.Main.main(Main.java:245)
Unknown source file : at com.android.dx.command.Main.main(Main.java:106)
:app:dexDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException:
Process 'command 'C:\Program Files\Java\jdk1.8.0_102\bin\java.exe'' finished with non-zero exit value 2
* 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: 50.673 secs
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/android-setup.html
I have no idea about this error. Saw some questions similar to this but could not find the answer. I'm new to React-Native and Android development so I'm having hard time understanding this stuff.
This problem usually comes from gradle dependency in new components, i can see you have installed react-native-maps
you can solve it by cleaning the project.
In your React Native project:
cd android/ && ./gradlew clean
go back and try run it again.
cd .. && react-native run-android
to be more specific:
in your MainApplication.java file, change,
protected boolean getUseDeveloperSupport() { { <-----
on this
public boolean getUseDeveloperSupport() { <-----
that got it building for me, at least
The problem for me was that, the packager was running in the background from the previous build.
You might just try to close the packager server and start it with
react-native run-android
That was successful for my problem.
Use these steps
1.) cd android
2.) gradle clean
3.) Now run the project.
This error occurs in my system whenever the emulator is updated.
just run this from root of your project with cmd:
cd android && gradlew clean

App won't build? DebugResources error?

Here is my problem
Can anyone help?
Ive tried changing the build version on gradle but it still doesnt run
[1] http://imgur.com/U5CP8rO
BUILD FAILED
Total time: 11.872 secs
Executing tasks: [:app:compileDebugSources, :app:compileDebugAndroidTestSources]
Configuration on demand is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72300Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2300Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42300Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
AAPT err(Facade for 1220063698): libpng error: Not a PNG file
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Some file crunching failed, see logs for details
* 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: 11.771 secs
WHEN I TRY TO CLEAN BUILD:
Executing tasks: [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources]
Configuration on demand is an incubating feature.
:clean
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72300Library FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:prepareComAndroidSupportAppcompatV72300Library'.
> Failed to create parent directory 'P:\BudgetWiseApp\app\build' when creating directory 'P:\BudgetWiseApp\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.0'
* 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: 13.896 secs
Your log shows this:
AAPT err(Facade for 1220063698): libpng error: Not a PNG file
This means that somewhere you have an image resource that is not a PNG.
The log usually shows which file is causing the problem, but you might need to run with the --stacktrace option (e.g. gradlew assembleDebug --stacktrace).
If that still doesn't show the file name, you will need to look through your drawable folders for images that aren't PNGs.
Build -> Clean Project
Build -> Rebuild Project
make sure the images in your drawable is in png format.
you can convert any image in png format just by opening with a image editor and save as png.

Android: Error in R.Java <identifier> expected

I have copied this code from somewhere to create a Webview app with Splash screen. But, I keep getting this R.java error while building the app file:
Configuration on demand is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources
:app:generateDebugSources
:app:compileDebugJavaWithJavac
/Users/Varun/AndroidStudioProjects/DiagnoseECG/app/build/generated/source/r/debug/package com/abcofecg/app/diagnoseecg/R.java:8: error: <identifier> expected
package package com.abcofecg.app.diagnoseecg;
^
/Users/Varun/AndroidStudioProjects/DiagnoseECG/app/build/generated/source/r/debug/package com/abcofecg/app/diagnoseecg/R.java:8: error: class, interface, or enum expected
package package com.abcofecg.app.diagnoseecg;
^
/Users/Varun/AndroidStudioProjects/DiagnoseECG/app/build/generated/source/buildConfig/debug/package com/abcofecg/app/diagnoseecg/BuildConfig.java:4: error: <identifier> expected
package package com.abcofecg.app.diagnoseecg;
^
/Users/Varun/AndroidStudioProjects/DiagnoseECG/app/build/generated/source/buildConfig/debug/package com/abcofecg/app/diagnoseecg/BuildConfig.java:4: error: class, interface, or enum expected
package package com.abcofecg.app.diagnoseecg;
^
4 errors
FAILED
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.
BUILD FAILED
Total time: 5.302 secs
Please Help me out to resolve this issue.
This is what I do when something like this happens.
(1) Clean project/build
(2) Rebuild project
(3) Sync Gradle
(4) Reboot Android Studio
Maybe one of these could solve your issue

Categories