Impossible to run app with Parse - java

I have an issue with Parse. I had the sdk (downloaded on Parse.com and unzip inside /libs folder in my project) and when I build everything is good.
But when I run the app,I have this following error :
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_66\bin\java.exe'' finished with non-zero exit value 2
I don't know what to do, I search and tried everything I found on StackOverflow and github repo of Parse but nothing works :/
Any idea ?
Thanks in advance for your answer.

Simple in your gradle file add these ...
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
// add dexOptions
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}
dependencies {
provided fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.parse:parse-android:1.11.0'
// add multidex dependency
compile 'com.android.support:multidex:1.0.1'
}
reference: Error:Execution failed for task ':app:dexDebug' error in my project while I added new dependency

Try to clean your project (Build -> Clean Project) or try to add this:
defaultConfig {
multiDexEnabled true
}
to your build.gradle file

Try to add the following code to your build.gradle (module: app)
dependencies{
...
...
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
}
and no need of adding multiDex.
Hope this should work.

Related

Error:Execution failed for task ':app:compileDebugJavaWithJavac

I'm facing this problem when I try to run my app
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
java.io.FileNotFoundException: C:\Users\ggg\Desktop\android\app\libs\support-v4-25.1.0.jar (The
system cannot find the file specified)
this is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.gumball.at.adventure"
minSdkVersion 14
targetSdkVersion 23
ndk {
moduleName "player_shared"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.google.android.gms:play-services:+'
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/support-v4-25.1.0.jar')
}
any help please
Change your targetSdkVersion to 25
and add this line
multiDexEnabled true
You can add dependencies from here
Try to replace
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/support-v4-25.1.0.jar')
to
compile fileTree(dir: 'libs', include: ['*.jar'])
for including jar library files in your project.
Best you can use gradle dependencies functionalities to add library in your project. Example
compile 'com.android.support:support-v4:25.1.0'
It will automatically download the required library to the project. You don't need to download manually jar files and add to the project.

New AndroidStudio 2.3 Error

I have just installed new Android Studio and tried to create a new project. But I get this strange error. I am using 32 bit Linux system.
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: AAPT process not ready to receive commands
Information:BUILD FAILED
Error:java.util.concurrent.ExecutionException: java.lang.RuntimeException: AAPT process not ready to receive commands
Information:Total time: 14.838 secs
Information:2 errors
Information:0 warnings
Information:See complete output in console
I don't understand why I am getting this error.
Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.sandesh.testing"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
Gradle (project)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
In your case problem is newest Android Studio does not run on 32bit only system. On download page you can check the requirement also:
64-bit distribution capable of running 32-bit applications
The newest version does not support 32bit. I think you should try with one solution but I dont know how long it will work :
Step1.Go to terminal
Step2.type gedit .profile
Step3.paste the below line at end of the page
Step4.export ANDROID_EMULATOR_FORCE_32BIT=true
Step5.type source .profile in terminal or restart system
Please remember that may be in future Android Stdio stop supporting this too so its better you should move to bit64 or downgrade your version of android studio.

Could not find method exclude() for arguments [{module=support-v4}]

I am trying to run my application with instant run turned off but I get this error:
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
android/support/v4/view/KeyEventCompatEclair.class
Here is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.jua.app"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile project(path: ':app_Data')
compile files('libs/android-support-v4.jar')
}
I tried the solution from this thread:
compile files('libs/android-support-v4.jar'){
exclude module: "support-v4"
}
And now I am receiving this error when I try to Sync now gradle.build:
Error:(29, 0) Could not find method exclude() for arguments
[{module=support-v4}] on file collection of type
org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection.
Open File
I am a little lost right now, If anyone has any idea how to solve this I would appreciate it.
EDIT
I removed
compile files('libs/android-support-v4.jar')
completly and I still get the first error.
This is a syntax issue. The closure in which you are calling exclude is being interpreted as an argument to the files() method, which is incorrect. Should look like this
compile (files('libs/android-support-v4.jar')){
exclude module: "support-v4"
}
For anyone having the same problem, I deleted android-support-v4.jar from folder and now it works. For some reason, if you remove it from inside the gradle.build file it continues to create problems.

Compiling compatibility issue external libraries

I were trying to use the Selenium WebDriver for an Android application. (I am using the latest AndroidStudio; v2.2)
I followed this guide so in the lib's my app I copied the jar files (the downloaded zip of Selenium WebDriver has a folder named "libs", a jar named "client-combined-3.0.0-beta4-nodeps" and a DEPENDENCIES and a LICENSE file[I've just copied all the jars in the "libs" folder and the other jar outside])
Here's the build.gradle (module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.example.utente.downall"
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions{
pickFirst("META-INF/LICENSE")
pickFirst("META-INF/DEPENDENCIES")
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
compile files('libs/cglib-nodep-3.2.4.jar')
compile files('libs/client-combined-3.0.0-beta4-nodeps.jar')
compile files('libs/commons-codec-1.10.jar')
compile files('libs/commons-exec-1.3.jar')
compile files('libs/commons-logging-1.2.jar')
compile files('libs/gson-2.3.1.jar')
compile files('libs/guava-19.0.jar')
compile files('libs/hamcrest-core-1.3.jar')
compile files('libs/hamcrest-library-1.3.jar')
compile files('libs/httpclient-4.5.2.jar')
compile files('libs/httpcore-4.4.4.jar')
compile files('libs/httpmime-4.5.2.jar')
compile files('libs/jna-4.1.0.jar')
compile files('libs/jna-platform-4.1.0.jar')
compile files('libs/junit-4.12.jar')
compile files('libs/netty-3.5.7.Final.jar')
compile files('libs/phantomjsdriver-1.3.0.jar')
}
(Project synched)
While executing "run" I had this error:
Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
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
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
So I've gone to the build.gradle (Project: DownAll) and I added these target/source compatibility, so here's what's like:
I cleaned the project, rebuilded it, re-synched it but still the same error.
What should I do?
If it can help, here's my environment variables, if it can help:
JAVA_HOME
C:\Program Files\Java\jdk1.8.0_102
ANDROID_HOME
C:\Users\Utente\AppData\Local\Android\sdk;C:\Users\Utente\AppData\Local\Android\sdk\tools;C:\Users\Utente\AppData\Local\Android\sdk\platform-tools
(AppData folder is hidden)
EDIT:
UP
I just faced the exact same error and figured out that com.google.guava:guava:21.0 was causing the problem; app starts working right after downgrading it to 20.0.
So, I guess some of your jars might be incompatible.
Try downgrading / removing dependencies one by one.

Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException

I am building my android project when i got this error after import docx4j library in my project. What should i do to get rid of this exception.
Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2
Add this to your file build. gradle
defaultConfig {
multiDexEnabled true
}
The Android plugin for Gradle available in Android SDK Build Tools 21.1 and higher supports multidex, so you have to add multiDexEnabled true to your gradle file like below :
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
I might need more information but according to the error on your question:
Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2
The IntelliJ compilation way might cause the error you post (at least in my case, it does). I recently came from Eclipse, where a 'Clean Project' is made after every run. In IntelliJ, the project needs a clean build to be run.
I've avoided cleaning every time, disabling incremental flag inside dexOptions of the build.gradle.
I ran into the same problem and I did add the multiDexEnabled true in build file but all in vain. But doing the following along with adding multiDexEnabled true in defaultConfig solved my problem.
Add the MultiDexApplication in your manifest like :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
And dont forget to add
defaultConfig {
multiDexEnabled true
}
The did the trick for me. Ref : Android Studio fails to debug with error org.gradle.process.internal.ExecException
I had got the same error. But I resolved the issue by adding the following missing line from build.gradle in dependencies.
compile 'com.parse.bolts:bolts-android:1.+'
After adding this line, my dependencies body was like this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile fileTree(dir: 'libs', include: "commons-io-2.4.jar") }
You can match with yours too and see if it can help you too
the same as my error
Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2enter code here
it is because there is a duplication of its dependency lib, in my case like this
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpmime-4.3.6.jar')
compile fileTree(include: ['*.jar'], dir: 'libs')
then I fixed it to be like this
compile fileTree(include: ['*.jar'], dir: 'libs')
remove other setting import lib
I hope this helps
This Problem can easily be resolved by Removing multiple jar in your project libs folder.

Categories

Resources