Could anyone help me out with the following error. When i clean the project, it doesn't show any error but every time i try to run i get this message.
Error: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_45\bin\java.exe'' finished with non-zero exit value 2
The application was running with no errors but as my system crashed and restarted android studio i had few updates for Android API 22. After the update the application keep giving me this error message. I downloaded JDK 8 and tried to run but didn't work. Later i downgraded to JDK 7 after this stack post but still has not fixed it.
Is it possible to use Java 8 for Android development?
I have looked through numerous similar question but none works for me. Some similar issues found on stack were
why java.exe exit with value 1 in android studio
Error:Execution failed for task ':app:dexDebug'. > comcommand finished with non-zero exit value 2
Java finished with non-zero exit value 2 - Android Gradle
java.exe finished with non-zero exit value 2
Process 'command' C: \ Program Files \ Java \ jdk1.8.0_31 \ bin \ java.exe '' finished with a non -zero exit value 2
I have looked through dependencies in gradle built to see if there were any conflict but found none.
I even tried to copy the code into a new project and run it but still no success. Anyone who has faced the same issue and solved it please help me out.
After days of trying out finally could fix the issue. The problem with one of my .jar files. I had to remove each jar and check one by one until i found it. I removed the .jar file and cleaned my project and ran successfully. If any one should face similar issue check your jar file one by one.
I had the same error
app:dexDebug ExecException finished with non-zero exit value 2
i solve it by adding this line of code
defaultConfig {
multiDexEnabled true
}
The reason is that i was using too many libraries
Hope this post will help anyone
I had the same problem when I compiled google play services to my dependencies.
My mistake was I was compiling the enitre package like this
compile 'com.google.android.gms:play-services:8.3.0'
Instead when I tried the selective compile, it worked.In my case I was using for google sign in,so it had just had to be
compile 'com.google.android.gms:play-services-auth:8.3.0'.
More details are in the documentaion. https://developers.google.com/android/guides/setup#split
Hope this will be of a little help to someone someday :)
I know it's late.
But that's what actually worked for me.
1. Build > Clean Project
2. Close gradle daemon processes (ps -e| grep gradle //this will list gradle processes)
3. File > Invalidate caches & Restart
I hope this will work for everyone.
For future readers. If you're using your own AARs and upgraded one that has a shared dependency, you can also just try cleaning the project. In Android Studio "Build" -> "Clean Project".
This solved the issue for me, so I'd recommend giving it a quick try before you start digging for dependencies.
For me the solution was to remove an unnecessary/duplicate dependency entries. This is a similar solution others offered here that makes sense, but not exactly the same solution as those offered by others.
Since I was already including *.jar files in the list of files to be compiled, there was no need for additional entries in the dependencies list.
Before:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
}
After:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
}
Remove
compile 'com.parse:parse-android:1.+'
add this linecompile fileTree(dir: 'libs', include: ['Parse-*.jar'])
Finally, it will look like this
dependencies {
compile fileTree(dir: 'libs', include: ['Parse-*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
compile 'com.android.support:design:22.2.0'
compile 'com.parse.bolts:bolts-android:1.+'
}
I had the same problem, just i did Biuld--> Rebiuld project and it works again ;)
I was using the robolectric dependency in my android project. I removed all robolectric dependencies in gradle and deleted all my robolectric tests, then I built the app and finally I could run the android project. Hope this can work for us.
I faced the same problem when trying to add the SignalR Java client library to my project's dependencies. I first changed the target JDK of my app from 1.8.0_XX to 1.7.0_XX, but it didn't work. Then I changed the SignalR project to target 1.7.0_XX as well, rebuilt and added it to my project's libs folder instead of the first build (which was in 1.8.0_XX), and that miraculously worked.
For me, the problem was that I was using different versions of "Google Play services sub API's"
Before:
Click to see the image
After:
Click to see the image
Check if there are 2 classes with same name. Each class name should be unique.
maybe for this issue you got means you added same liberay file in more than one time
Related
i am facing PhaseScriptExecution error
when i try to build IOS then project not build this give the following error
the following build commands failed:
PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/ali/Library/Developer/Xcode/DerivedData/NassauTennisMobileApp-akwowvjtagvlxbalhbsvukoitagy/Build/Intermediates.noindex/NassauTennisMobileApp.build/Debug-iphonesimulator/NassauTennisMobileApp.build/Script-00DD1BFF1BD5951E006B06BC.sh
For me: It seems that react native doesn't like spaces in the directory. I was able to build my ios after removing all of the spaces in my directory.
Potential solution to your problem, didn't fix mine but it might help you: The author suggests there is a mismatch between the node version that you're using and the one that xcode is calling/using. The author provides a way to check the versions installed as well as a way to symlink between the two versions => https://dev.to/glocore/react-native-command-phasescriptexecution-failed-of9
can someone please help me, I can't get the step definitions to work. I've took a screen shot of the Andoid Studio work place, as i thought it be easier then explaining it all. Basically I want to run the feature file myfeature.feature and when i do i want it to pick up the steps that are defined in the MyStepdef Class. I'm sure it an easy fix but this has not worked for me for a number of days
UPDATE!
I downloaded the skeleton class (as suggested) and even managed to run it in its own android workspace. Tried to implement with my program, using the classes from the skeleton, same feature, same set up but cannot run it.
I tried to create the feature file from scratch, the using android to set the stepdefintions from that feature file and still cannot run it
My thoughts are that I have the gradle set up to run an other automated test, in which i had complication, now I got them perfect with the "solution" i posted [//stackoverflow.com/questions/36968728/android-studio-testing-library-dependencies-that-have-been-compiled-using-java/36975041#36975041]
I have a feeling that the automated test setup that works well with expresso will not run well for the cucumber feature tests.
Anytime I add the jvm (0.5) and delete the exclude statements the old error comes bacK
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
Error:1 error; aborting
:app:transformClassesWithDexForDebugAndroidTest FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_74\bin\java.exe'' finished with non-zero exit value 1*
Anytime I apply the exclude cucumber-jvm-deps on to a dependecny, I can run the espresso tests but not the cucumber.feature - either it does not recognise steps or if run using the JUnit (as in the skeleton) setup I get a completely new error
"C:\Program Files\Java\jdk1.8.0_91\bin\java" -ea -Didea.launcher.port=7533 "-Didea.launcher.bin.path=C:\Program Files\Android\Android Studio\bin" -Didea.junit.sm_runner -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Android\Android Studio\lib\idea_rt.jar;C:\Program Files\Android\Android Studio\plugins\junit\lib\junit-rt.jar;C:\Users\hbill\AppData\Local\Android\sdk\platforms\android-23\android.jar;C:\Users\hbill\AppData\Local\Android\sdk\platforms\android-23\data\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\classes\debug;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-html\0.2.3\624a0c986088e32910336dd77aee5191c04a8201\cucumber-html-0.2.3.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\runner\0.5\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\runner\0.5\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-idling-resource\2.2.2\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-idling-resource\2.2.2\jars\classes.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\org.hamcrest\hamcrest-library\1.3\4785a3c21320980282f9f33d0d1264a69040538f\hamcrest-library-1.3.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\org.hamcrest\hamcrest-integration\1.3\5de0c73fef18917cd85d0ab70bb23818685e4dfd\hamcrest-integration-1.3.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.3.0\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.3.0\jars\libs\internal_impl-23.3.0.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.3.0\res;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\com.google.code.findbugs\jsr305\2.0.1\516c03b21d50a644d538de0f0369c620989cd8f0\jsr305-2.0.1.jar;C:\Users\hbill\AppData\Local\Android\sdk\extras\android\m2repository\com\android\support\support-annotations\23.3.0\support-annotations-23.3.0.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\support-vector-drawable\23.3.0\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\support-vector-drawable\23.3.0\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\animated-vector-drawable\23.3.0\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\animated-vector-drawable\23.3.0\res;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\gherkin\2.12.2\17138631fa20fd0e44a13e50d6b7be59cee1a94\gherkin-2.12.2.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.3.0\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.3.0\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-core\2.2.2\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-core\2.2.2\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\exposed-instrumentation-api-publish\0.5\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\exposed-instrumentation-api-publish\0.5\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\rules\0.5\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\rules\0.5\jars\classes.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\javax.annotation\javax.annotation-api\1.2\479c1e06db31c432330183f5cae684163f186146\javax.annotation-api-1.2.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\javax.inject\javax.inject\1\6975da39a7040257bd51d21a231b76c915872d38\javax.inject-1.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-core\1.2.4\72790b1da44d8d3d2764c6aef29865ee228bbeb1\cucumber-core-1.2.4.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\com.google.guava\guava\17.0\9c6ef172e8de35fd8d4d8783e4821e57cdef7445\guava-17.0.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-junit\1.2.4\8a57b68486cff4da4f10019cb9c62c597a6d2861\cucumber-junit-1.2.4.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-android\1.2.4\cf6fd6b0de808c6b28bf8e9d22f6572a180930a3\cucumber-android-1.2.4.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\com.squareup\javawriter\2.1.1\67ff45d9ae02e583d0f9b3432a5ebbe05c30c966\javawriter-2.1.1.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\org.hamcrest\hamcrest-core\1.3\42a25dc3219429f0e5d060061f71acb49bf010a0\hamcrest-core-1.3.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-java\1.2.4\57cca534b7abe43f6dd7624b90d3d97d33d3023d\cucumber-java-1.2.4.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\junit\junit\4.12\2973d150c0dc1fefe998f834810d68f278ea58ec\junit-4.12.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-jvm-deps\1.0.3\cccdeff234db8b12e91ae2529812f1240b4d5603\cucumber-jvm-deps-1.0.3.jar" com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 boo.thefoodhunt.RunCukesTest
!!! 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:205)
at com.intellij.rt.execution.junit.JUnitStarter.canWorkWithJUnitVersion(JUnitStarter.java:188)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
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:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Process finished with exit code -3
Now i hate to be defeated, but I think im just going to have to leave it and go around it somehow (even though its for testing coursework :/) because this has took so much out of my time, and eating in to my revision.
I have took the screen shots of my settings (in case of quick fix, silly mistake)
JUnit - Run Setup
Cucumber Feature Setup
TBH the suggestion below regarding the CLI, I'm not sure what is meant as this is the first time I tried to setup a testing enviroment, I understand it to be the set as a type of Main activity for the test to be ran? , but i do not know how to set it any other way.
The grade build dependcies :
compile 'com.android.support:appcompat-v7:23.3.0'
androidTestCompile('info.cukes:cucumber-java:1.2.4') {
exclude module: 'cucumber-jvm-deps'
}
androidTestCompile('info.cukes:cucumber-junit:1.2.4') {
exclude module: 'cucumber-jvm-deps'
}
androidTestCompile('info.cukes:cucumber-core:1.2.4') {
exclude module: 'cucumber-jvm-deps'
}
androidTestCompile 'junit:junit:4.12'
compile 'com.android.support:support-annotations:23.3.0'
compile 'com.google.guava:guava:17.0'
androidTestCompile 'com.android.support:support-annotations:23.3.0'
compile 'info.cukes:gherkin:2.12.2'
// androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile('info.cukes:cucumber-android:1.2.4') {
exclude module: 'cucumber-jvm-deps'
}
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'info.cukes:cucumber-jvm:1.2.4'
androidTestCompile('info.cukes:cucumber-html:0.2.3') {
exclude module: 'cucumber-jvm-deps'
}
compile 'info.cukes:cucumber-jvm-deps:1.0.3'
The message you see is that the steps are undefined but have implemented the stubs.
This tells me that the place you have implemented the stubs are not in the correct part of the classpath. There is probably something wrong with your glue.
You want the steps to be in the same package, or a sub-package, as the test runner. That is the class where you invoke the Cucumber runner.
I would consider adding a JUnit class annotated as in the https://github.com/cucumber/cucumber-java-skeleton to run Cucumber.
#RunWith(Cucumber.class)
public class RunCukesTest {
}
Note that this class has to be in the test classpath.
This is different from your current approach where you are using the CLI to invoke Cucumber.
I am going to create the app that shows google map and required social login with facebook.
I decided to use:
https://github.com/Wizcorp/phonegap-facebook-plugin
and
https://github.com/wf9a5m75/phonegap-googlemaps-plugin
I don't know what is a reason, but these plugins perfectly work alone, but when I installed them together I got next error:
BUILD FAILED
C:\Users\{USER_NAME}\AppData\Local\Android\sdk\tools\ant\build.xml:577: Jar mismatch! Fix your dependencies
Total time: 1 second
{APP_PATH}\platforms\android\cordova\node_modules\q\q.js: 126
throw e;
^
Error code 1 for command: cmd with args: /s /c "ant debug -f {APP_PATH}\platforms\android\build.xml -Dout.dir=ant-build -Dgen.absolute.dir=ant-gen"
ERROR running one or more of the platforms: Error: {APP_PATH}\platforms\android\cordova\run.bat: Command failed with exit code 8
You may not have the required environment or OS to run this project
I am not experienced in PhoneGap development, but I guess that both plugins are doing some changes in platform dependencies (and rewriting changes of another plugin).
Could anybody help me with this?
I got the answer of google-maps plugin creator:
The facebook plugin contains android-support-v4.jar, and the map
plugin installs another android-support-v4.jar.
Remove one of them.
I took off android-support-v4.jar from com.phonegap.plugins.facebookconnect folder and left it in libs folder. It was solved my issue (fb and g-maps work together).
So I can mark this question as closed now.
I leave this answer for anybody who meets this issue like me.
Since yesterday, I got Failed to find: io.realm:realm-android:0.71.0.
It is in my dependencies:
dependencies {
...
compile 'io.realm:realm-android:0.71.0'
...
}
Is this a bug?
The project compiled perfectly before.
What has changed since then:
Added Crashlytics
Bumped buildtoolsversion: buildToolsVersion "21.1.0"
Log:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_paidDebugCompile'.
Could not find io.realm:realm-android:0.73.1.
Searched in the following locations:
https://repo1.maven.org/maven2/io/realm/realm-android/0.73.1/realm-android-0.73.1.pom
https://repo1.maven.org/maven2/io/realm/realm-android/0.73.1/realm-android-0.73.1.jar
file:/C:/Users/thomasbeerten/.m2/repository/io/realm/realm-android/0.73.1/realm-android-0.73.1.pom
file:/C:/Users/thomasbeerten/.m2/repository/io/realm/realm-android/0.73.1/realm-android-0.73.1.jar
http://download.crashlytics.com/maven/io/realm/realm-android/0.73.1/realm-android-0.73.1.pom
http://download.crashlytics.com/maven/io/realm/realm-android/0.73.1/realm-android-0.73.1.jar
file:/C:/Users/thomasbeerten/sdk backup/sdk/extras/android/m2repository/io/realm/realm-android/0.73.1/realm-and
roid-0.73.1.pom
file:/C:/Users/thomasbeerten/sdk backup/sdk/extras/android/m2repository/io/realm/realm-android/0.73.1/realm-and
roid-0.73.1.jar
file:/C:/Users/thomasbeerten/sdk backup/sdk/extras/google/m2repository/io/realm/realm-android/0.73.1/realm-andr
oid-0.73.1.pom
file:/C:/Users/thomasbeerten/sdk backup/sdk/extras/google/m2repository/io/realm/realm-android/0.73.1/realm-andr
oid-0.73.1.jar
Required by:
YoMommaOClock:app:unspecified
Christian from Realm here. Thats odd, neither of these two things should have any effect on Realm.
Without further information i would check:
1) Do you have the following in your build.gradle file?
repositories {
jcenter()
}
2) Try running "./gradlew clean assemble --refresh-dependencies" from your project. That should refresh your local dependency cache.
Apart from that, we just released 0.73.1, I would suggest you upgrade to that version :)
This question already has an accepted answer but in case you still having problems like me, this is what worked for me i unchecked offline work at
settings -> build... -> build tools -> build->gradle
but before make sure you have jcenter() in your dependency as described in the accepted answer.
For 2 days, I have been trying to fix my Android Studio setup, but despite a lot of googling have had no luck fixing this problem. Gradle keeps giving me the error
Error:Execution failed for task ':Android-Tabbedout-30:processQaReleaseResources'.
Error: A library uses the same package as this project
You can temporarily disable this error with android.enforceUniquePackageName=false
However, this is temporary and will be enforced in 1.0
If I add in the enforceUniquePackageName=false to the gradle file, then the project can be successively refreshed by Gradle, but once I try to run it I get this error:
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define
Any ideas on how to fix this?
I was searching for that same problem and i find this on github
https://github.com/DWorkS/AStickyHeader/issues/12
And this solved my problem.
All this says is to rename the package name on the AndroidManifast.xml file.
And its done.