I just imported baseGameUtils to my android game in order to add a Google play Leaderboard however, when I press play I get this 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 2`
I tried following the instructions from these two pages: Stackoverflow question 1, Stackoverflow question 2.
I tried setting the google support libraries to 22.2.1 and 8.1.0 in the basegameutils build.gradle, but then I get missing dependencies in the .java files in that library.
I'm all out of ideas and in need of help.
Thank you all in davance.
app:build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.honeycomb.touchtycube"
minSdkVersion 14
targetSdkVersion 22
versionCode 11
versionName "1.1.6"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile project(':facebook');
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services-ads:8.1.0'
compile 'com.google.android.gms:play-services-games:8.1.0'
compile project(':BaseGameUtils')
//compile project(':libs:basegameutils')
//compile 'com.purplebrain.adbuddiz.sdk:AdBuddiz-Java:3.0.15'
compile files('src/main/java/com/honeycomb/touchtycube/testapp/libs/AdBuddiz-3.0.15.jar')
}
repositories {
maven {
url 'http://repository.adbuddiz.com/maven'
}
}
BaseBuildUtils:build_gradle:
apply plugin: 'com.android.library'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
dependencies {
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!hasProperty('appcompat_library_version')) {
ext.appcompat_library_version = '20.0.+'
}
if (!hasProperty('support_library_version')) {
ext.support_library_version = '20.0.+'
}
if (!hasProperty('gms_library_version')) {
ext.gms_library_version = '7.8.0'
}
compile "com.android.support:appcompat-v7:${appcompat_library_version}"
compile "com.android.support:support-v4:${support_library_version}"
compile "com.google.android.gms:play-services-games:${gms_library_version}"
compile "com.google.android.gms:play-services-plus:${gms_library_version}"
compile "com.google.android.gms:play-services-appstate:${gms_library_version}"
}
android {
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!hasProperty('android_compile_version')) {
ext.android_compile_version = 20
}
if (!hasProperty('android_version')) {
ext.android_version = '20'
}
compileSdkVersion android_compile_version
buildToolsVersion android_version
}
EDIT:
I can do a "make Project" without any errors, the errors only appear when I do a "run app" (Or well I guess it's technically "run 'configuration'").
Check you prograud rules once. Also add your gradle build file.
Related
I am trying to build an android project from android studio version 3.0.1. When I try to compile my project I stuck into this error
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 11 cannot be smaller than version 14 declared in library [com.parse:parse-android:1.16.7] E:\codecanyon-19950163-whatsapp-status-downloader\WhatsDownloader\WI Video Downloader\app\build\intermediates\exploded-aar\com.parse\parse-android\1.16.7\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.parse" to force usage
Please suggest a solution to solve this solution but i cannot fix this issue
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.kingdov.whatsapp_status_downloader"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "KINGDOV"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mani:ThinDownloadManager:1.2.2'
compile 'net.rdrei.android.dirchooser:library:3.2#aar'
}
Now I am getting this from the stack trace
Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugResources'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
Go to Gradle Scripts > build.gradle(module: app)
search for
defaultConfig {
...........
minSdkVersion 11 //change this to 14
..........
}
It seems that your minimum API cant be lower than 14 because of a library. To fix, go to File, Project Structure,Then under Modules click App, then Flavors and change in the textbox minSdk to something higher than 14. Hope that helps!
I am trying to import a project in android Studio but if Fails
Following is the project:
project
I get this error:
> C:\xampp\htdocs\freedom\Android-IP-Camera-master\spydroid-ipcamera-master\app\build\intermediates\res\merged\debug\values-ldltr-v21\values-ldltr-v21.xml
> Error:(3) Error retrieving parent for item: No resource found that
> matches the given name 'android:Widget.Material.Spinner.Underlined'.
> Error:(3) Error retrieving parent for item: No resource found that
> matches the given name 'android:Widget.Material.Spinner.Underlined'.
> C:\xampp\htdocs\freedom\Android-IP-Camera-master\spydroid-ipcamera-master\app\build\intermediates\res\merged\debug\values-v21\values-v21.xml
> Error:(17) Error retrieving parent for item: No resource found that
> matches the given name 'android:TextAppearance.Material.Inverse'.
EDIT:
Below are both gradle files of the project.
build.gradle (Module:app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "net.majorkernelpanic.spydroid"
minSdkVersion 14
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile 'com.google.android.gms:play-services:+'
compile files('libs/acra-4.4.0.jar')
compile files('libs/GoogleAdMobAdsSdk-6.1.0.jar')
compile files('libs/sc-light-jdk15on-1.47.0.2.jar')
compile files('libs/scpkix-jdk15on-1.47.0.2.jar')
compile files('libs/scprov-jdk15on-1.47.0.2.jar')
}
build.gradle(Project: spydroid-ipcamera-master):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
allprojects {
repositories {
jcenter()
}
}
First of all change
compile files('libs/acra-4.4.0.jar')
compile files('libs/GoogleAdMobAdsSdk-6.1.0.jar')
compile files('libs/sc-light-jdk15on-1.47.0.2.jar')
compile files('libs/scpkix-jdk15on-1.47.0.2.jar')
compile files('libs/scprov-jdk15on-1.47.0.2.jar')
to compile fileTree(include: ['*.jar'], dir: 'libs')
second try to use the app combat library, cause some resources are missing
compile 'com.android.support:appcompat-v7:25.4.0'
or you can up your compileSdkVersion && targetSdkVersion to 21+
I import related project and chages some thing in build.gradle to last version that recomended by AS.
Change your build.gradle (Module:app) with this and try:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "net.majorkernelpanic.spydroid"
minSdkVersion 14
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:25.3.1'
compile 'com.google.android.gms:play-services:11.0.0'
compile files('libs/acra-4.4.0.jar')
compile files('libs/GoogleAdMobAdsSdk-6.1.0.jar')
compile files('libs/sc-light-jdk15on-1.47.0.2.jar')
compile files('libs/scpkix-jdk15on-1.47.0.2.jar')
compile files('libs/scprov-jdk15on-1.47.0.2.jar')
}
In my case project sync and run perfectly.
UPDATE:
I'll add that you must also change deprecated apache HttpClient with the new HttpURLConnection.
For this purpose add below code to your build.gradle (Module:app) : useLibrary 'org.apache.http.legacy'
I'm unable to run my app. Every time I'm trying to run my app in emulator Android studio shows me 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 (x86)\Java\jdk1.8.0_66\bin\java.exe'' finished with non-zero exit value 2
Here's my build.gradle files.
build.gradle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.gripxtech.kasim.unipayretailer"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName '1.0'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.malinskiy:superrecyclerview:1.1.1'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.codinguser.android:contactpicker:3.0.0#aar'
compile 'com.squareup.okhttp:okhttp:2.7.0'
compile project(':materialdatetimepick')
}
build.gradle(Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
allprojects {
repositories {
jcenter()
}
}
I've already tried to apply solution from many question similar to mine but, still I can't solve my issue. Thanks in Advance.
Add this to build.gradle file:
android {
...
defaultConfig {
...
multiDexEnabled true
}
}
Here you would find an explanation why this error happened:
UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define
If it wouldn't work, please delete all files and folders from:
YOUR_APP_NAME\app\build\intermediates
It sometimes happens when you have duplicated dependencies with different versions
Try this command and check if there something twice:
./gradlew dependencies
Hope it help
I'm new to Android and I can't get my first app to run. Whenever I try, it's throwing this error:
Android gradle :app:packageDebug FAILED: class org.bouncycastle.asn1.ASN1Primitive overrides final method equals.
I googled it and I found many questions there. As many said, this problem is probably due to the fact that I have multiple dependencies on BouncyCastle in my project. I tryed to remove the .gradle folder both in my project and in my local folder so I could download again the jars from the repository but nothing has changed. I also double checked that my JAVA_HOME is set and it's pointing to a 1.7 version. I tryed to gradle :app:clean and gradle :app:dependencies to see if I was missing something but still... I can't see any dependency from BouncyCastle... Can anybody help me?
Also, this problem occured without me changing any code... The app successfully worked yesterday and now is giving me this error... I don't get it. Thank you.
EDIT
gradle.build
Top-level:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Module app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.aurasphere.provaactionbar"
minSdkVersion 11
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services:7.0.0'
compile project(':volley')
compile files('libs/gson-2.2.2.jar')
}
Module volley:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.+'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 19
buildToolsVersion = '21.1.0'
}
apply from: 'rules.gradle'
rules.gradle for module volley:
apply plugin: 'com.android.library'
I've solved this problem myself just by changing the JDK I was using from x32 to x64 and now is compiling correctly.
My gradle execution fails with the error message listed below. I have searched a number of other answers on SO that suggest doing this:
dexOptions {
preDexLibraries = false
}
Some say it may be a memory error, some say it may be that a dependency may already include one of the dependencies I'm trying to compile. I've included the error message below along with my build.gradle file where you'll e able to see what dependencies I'm using. Any help is much appreciated!
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.3'
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 21
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "com.dreamengine.shout"
minSdkVersion 13
targetSdkVersion 21
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
preDexLibraries = false
}
}
dependencies {
//compile 'com.android.support:support-v4:+'
compile files('libs/Parse-1.7.1.jar')
compile 'com.squareup.picasso:picasso:2.3.4'
compile 'com.firebase:firebase-client-android:2.0.3'
compile 'com.squareup.okio:okio:1.0.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.1.0'
compile 'com.squareup.okhttp:okhttp:2.1.0'
compile 'com.squareup.retrofit:retrofit:1.8.0'
compile 'com.android.support:appcompat-v7:21.+'
compile 'com.google.android.gms:play-services:6.5.+'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.github.asne.facebook:facebook:3.17.2'
compile 'com.braintreepayments.api:braintree:1.+'
compile "com.mixpanel.android:mixpanel-android:4.4.1#aar"
// Crashlytics Kit
compile('com.crashlytics.sdk.android:crashlytics:2.1.0#aar') {
transitive = true
}
// Twitter Kit
compile('com.twitter.sdk.android:twitter:1.1.0#aar') {
transitive = true
}
// MoPub Kit
compile('com.mopub.sdk.android:mopub:3.2.2#aar') {
transitive = true
}
//Foursquare
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':Libraries:easyFoursquare4Android')
}
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:dexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Applications/Android Studio.app/sdk/build-tools/android-4.4W/dx --dex --num-threads=4 --output ...
Error Code:
137
Running of dx requires spawning a new VM. Creating fails, check if you have enough memory and/or set defaultXmx=-Xmx512m (or lower). Please also check out the answers here Android gradle build script returns error 137 in preDexDebug