Gradle Building Errors - java

I've been receiving the following error:
Error:Execution failed for task ':app:dexDebug'.>
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
'/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java''
finished with non-zero exit value 2
This is my current dependency. I have been trying to figure out how to resolve this error but I just can not figure it out. Any suggestions or help will be greatly appreciated.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.vokanovich.myapplication"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile ("com.magnet.mmx:magnet-mmx-client-android:1.9.1#aar") {
transitive=true
}
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.android.gms:play-services-base:7.8.0'
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile('com.mikepenz:materialdrawer:4.3.7#aar') {
transitive = true
}
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
}
And this is my other build.gradle
// 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.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
maven {
url "https://repo.magnet.com/artifactory/public"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

The issue was that it exceeded 65k methods. It was resolved by applying the following solution: https://stackoverflow.com/a/31759781/1371041

I had the same problem. Just write inside defaultConfig in build.gradle
defaultConfig {
multiDexEnabled true
}
Hope this help you!)

Related

Failed to execute aapt in Android Studio

Here are my Error Logs
I've tried invalidate and restart but that didn't work.
This happened after I updated Android Studio.
I can clean my project and rebuild it successfully, but when I run it, I get the errors.
Additionally info that might not be the cause:
I do get in an error in my styles.xml that "Theme" cannot be resolve
to a symbol, However, it never gave me errors when I rebuild the
project.
My styles.xml
My app build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.doggos.doggochat"
minSdkVersion 22
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true //important
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.firebase:firebase-client-android:2.5.2+'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.firebase:firebase-core:11.8.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
My Project build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
it's a bug in gradle code calling AAPT1. Remove android.enableAapt2=false and it should be fixed.
More info: Failed to execute aapt (NoSuchElementException at AbstractIndexedListIterator.next(AbstractIndexedListIterator.java:80)

FireBase Sync with Android Studio failed

I try implementing an app that put details about you in database in Firebase.
I do the sync with the code from the website from Firebase
Android Studio Version: 3.0.1
The Code is from THIS
build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
//you need to add this line
classpath 'com.google.gms:google-services:3.2.0' // google-services plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle in the app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.eranp.clientpage"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation files('libs/activation.jar')
implementation files('libs/additionnal.jar')
implementation files('libs/mail.jar')
compile 'com.google.firebase:firebase-auth:11.8.0'
}
apply plugin: 'com.google.gms.google-services'
The error output:
Error:Could not find com.google.gms:google-services:3.2.0. Searched
in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/google/gms/google-services/3.2.0/google-services-3.2.0.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/google/gms/google-services/3.2.0/google-services-3.2.0.jar
Required by:
project :
What do I need to do to fix that?

I have imported a project in android studio and have a "could not find android method" error

Here's the build.gradle file
// 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.2.3'
// 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
}
android {
buildToolsVersion '23.0.0'
}
dependencies {
}
Here is the app build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.currentplacedetailsonmap"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
resValue "string", "google_maps_key", (project.findProperty("GOOGLE_MAPS_API_KEY") ?: "")
}
buildTypes {
debug {
debuggable true
}
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.1.1'
compile 'com.google.android.gms:play-services:10.0.1'
testCompile 'junit:junit:4.12'
}
The error is
Error:(22, 0) Could not find method android() for arguments [build_4zgce4e0vr1il6017s3d6qypf$_run_closure3#4c674a56] on root project 'CurrentPlaceDetailsOnMap' of type org.gradle.api.Project.
Open File
How do I change this ,I have tried changing the build version too but it is not helping

Error:Configuration with name 'default' not found. Google did not know

Hello I have a problem with thise error
Error:Configuration with name 'default' not found.
my build.gradle :projeck
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// 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
}
my build.gradle :app
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.atry.paradox.listdrop"
minSdkVersion 15
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'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':library2')
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'
}
my settings.gradle
include ':app', ':library2'
I looking for thise error on google, but I found advice for copy library2 to main file. I have library 2 on the same file where I have app, build, gradle ...
Please where I Do error?
Thanks
It depends by the settings.gradle file:
include ':app', ':library2'
Gradle is looking for 2 projects (app and library2).
Each of these projects must have the build.gradle file inside.
root
|--build.gradle
|--settings.gradle
|--app
|----build.gradle
|--library2
|----build.gradle
This error:
Error:Configuration with name 'default' not found.
happens if a module (or more) doens't have the build.gradle file.
Check if your library2 folder has the build.gradle and the right structure.

Duplicate Files Copied-Bouncy Castle(bcpkix-jdk15on-1.48.jar)-How can I resolve that?

So I'm getting this annoying message(full message at the bottom at the message),and I have no idea which libraries include those bouncycastle files (I didn't include them myself directly),I'm guessing that two of them include different versions of the same files? :P
How can I know which packages/libraries included those? How can I solve the issue?
Here are the build.grade files:
App level:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "dor.only.dorking.android.profilemanager"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
apply plugin: 'com.google.gms.google-services'
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.android.support:design:23.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.android.gms:play-services-auth:8.3.0'
compile 'com.google.api-client:google-api-client:1.19.1'
compile 'com.google.apis:google-api-services-plus:v1-rev375-1.21.0'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.gms:google-services:2.1.0-beta3'
}
Project 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:2.0.0'
classpath 'com.google.gms:google-services:2.1.0-beta3'
// 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
}
And this is the error message (Gradle's output, I am using Android Studio):
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/BCKEY.DSA
File1: C:\Program Files\Android\Android Studio\gradle\m2repository\org\bouncycastle\bcpkix-jdk15on\1.48\bcpkix-jdk15on-1.48.jar
File2: C:\Program Files\Android\Android Studio\gradle\m2repository\org\bouncycastle\bcprov-jdk15on\1.48\bcprov-jdk15on-1.48.jar

Categories