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.7.0_51\bin\java.exe'' finished with non-zero exit value 1
hello i get this error, which i have no idea how to fix.
these are my gradles:
app gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc2"
defaultConfig {
applicationId "com.example.daniel.testing6"
minSdkVersion 15
targetSdkVersion 22
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'])
compile project(path: ':backend', configuration: 'android-endpoints')
//configurations { all*.exclude group: 'com.android.support', module: 'support-v4' }
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:design:22.2.1'
}
backend gradle:
// If you would like more information on the gradle-appengine-plugin please refer to the github page
// https://github.com/GoogleCloudPlatform/gradle-appengine-plugin
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.18'
}
}
repositories {
jcenter();
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.18'
compile 'com.google.appengine:appengine-endpoints:1.9.18'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.18'
compile 'javax.servlet:servlet-api:2.5'
compile 'com.googlecode.objectify:objectify:4.0b3'
compile 'com.ganyo:gcm-server:1.0.2'
}
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
endpoints {
getClientLibsOnBuild = true
getDiscoveryDocsOnBuild = true
}
}
project 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.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
does any one know how to fix it???
Related
AndroidManifest.xml Error: Package name
'android.support.graphics.drawable' used in:
com.android.support:animated-vector-drawable:28.0.0,
com.android.support:support-vector-drawable:28.0.0
https://imgur.com/6aFUN59
https://imgur.com/C1EmnJ3
An error happened after upgrade Android Studio 3.4
Already try change compileSdk to 27 / 27.1.1 but still same
and already try to disable "vector-drawable" lib but still same
.
.
.
.
.
.
.
.
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public'}
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.26.1'
classpath 'com.google.firebase:firebase-plugins:1.2.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'
android {
compileSdkVersion 28
defaultConfig {
applicationId "xxx.packacge.name"
minSdkVersion 21
targetSdkVersion 28
versionCode 4
versionName "Dev"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
applicationVariants.all { variant ->
//variant.getAssembleProvider()
variant.outputs.all {
outputFileName = "${variant.name}-${variant.versionName}.apk"
}
}
buildTypes {
release {
minifyEnabled false
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
buildToolsVersion = '28.0.3'
}
repositories {
mavenCentral()
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
configurations.all {
exclude group: 'com.android.support', module: 'support-v13'
}
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha5'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:support-fragment:28.0.0'
}
apply plugin: 'com.google.gms.google-services'
..
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven {
url 'https://maven.fabric.io/public'
}
maven {
url 'https://maven.google.com/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.firebase:firebase-plugins:1.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
mavenCentral()
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
..
You should try this way
implementation('com.android.support:support-vector-drawable:28.0.0') {
exclude group: 'android.support.graphics.drawable'
exclude module: 'support-vector-drawable'
}
implementation('com.android.support:support-vector-drawable:28.0.0') {
exclude group: 'android.support.graphics.drawable'
exclude module: 'support-vector-drawable'
}
try this one
I have the following set up:
Project
spring boot app
java classes that are packaged into a jar
android project
app module of the android project
I am trying to set up gradle build so that i get runnable spring boot jar application, java jar library that is installed in the local maven repo and an apk file for the android.
To get an apk file I need to run assembleDebug task
To publish java ibrary I need to run publish task
To get spring executable I need to run compileJave task
Question is what task to run on the top level root gradel.build file to get different tasks accomplished?
root gradle:
allprojects {
task hello << { task -> println "I'm $task.project.name" }
}
subprojects {
repositories {
mavenCentral()
jcenter()
}
}
Spring Boot gradle:
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
defaultTasks 'clean', 'build'
buildscript {
ext {
springBootVersion = '1.5.1.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle- plugin:${springBootVersion}")
}
}
jar {
baseName = 'demo'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('io.jsonwebtoken:jjwt:0.7.0')
compile('mysql:mysql-connector-java:6.0.5')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
Java Proj gradle:
jar {
baseName = 'commonobjects'
version = "0.0.1-SNAPSHOT"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
}
Android Proj gradle:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
Android App gradle:
def ANDROID_SUPPORT_DEPENDENCY_VERSION = '25.1.0'
def DAGGER_DEPENDENCY_VERSION = '2.8'
def OK_HTTP_DEPENDENCY_VERSION = '3.5.0'
def RETROFIT_DEPENDENCY_VERSION = '2.1.0'
def RETROFIT_JACKSON_DEPENDENCY_VERSION = '2.1.0'
def BUTTER_KNIFE_DEPENDENCY_VERSION = '8.5.1'
def JAVAX_ANNOTATION_JSR250_API_DEPENDENCY_VERSION = '1.0'
def GREEN_ROBOT_EVENT_BUS_DEPENDENCY_VERSION = '3.0.0'
def RX_JAVA_DEPENDENCY_VERSION = '2.0.5'
def RX_ANDROID_JAVA_DEPENDENCY_VERSION = '2.0.1'
defaultTasks 'clean', 'assembleDebug'
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "net.ltgt.gradle:gradle-apt-plugin:0.9"
}
}
repositories {
jcenter()
mavenCentral()
}
apply plugin: "com.android.application"
apply plugin: 'idea'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "..."
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
// debug {
// buildConfigField "String", "PARSE_APPLICATION_ID", "\"1\""
// buildConfigField "String", "PARSE_API_KEY", "\"1\""
// }
release {
minifyEnabled true
proguardFiles "android-proguard-android.txt", "proguard-rules.txt"
// buildConfigField "String", "PARSE_APPLICATION_ID", "\"1\""
// buildConfigField "String", "PARSE_API_KEY", "\"1\""
}
}
packagingOptions {
pickFirst 'META-INF/LICENSE'
}
}
dependencies {
// Add jars supplied
compile fileTree(dir: 'libs', include: ['*.jar'])
// Test related
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
androidTestCompile "com.android.support:support-annotations:${ANDROID_SUPPORT_DEPENDENCY_VERSION}"
androidTestCompile "com.android.support.test:runner:0.5"
// Android support libraries
compile "com.android.support:appcompat-v7:${ANDROID_SUPPORT_DEPENDENCY_VERSION}"
compile "com.android.support:design:${ANDROID_SUPPORT_DEPENDENCY_VERSION}"
compile "com.android.support:support-annotations:${ANDROID_SUPPORT_DEPENDENCY_VERSION}"
// An HTTP & HTTP/2 client for Android and Java applications
compile "com.squareup.okhttp3:okhttp:${OK_HTTP_DEPENDENCY_VERSION}"
// Retrofit: A type-safe HTTP client for Android and Java
compile "com.squareup.retrofit2:retrofit:${RETROFIT_DEPENDENCY_VERSION}"
compile "com.squareup.retrofit2:converter-jackson:${RETROFIT_JACKSON_DEPENDENCY_VERSION}"
// Butterknife: Field and method binding for Android views
compile "com.jakewharton:butterknife:${BUTTER_KNIFE_DEPENDENCY_VERSION}"
annotationProcessor "com.jakewharton:butterknife-compiler:${BUTTER_KNIFE_DEPENDENCY_VERSION}"
// Dagger DI
compile "com.google.dagger:dagger:${DAGGER_DEPENDENCY_VERSION}"
annotationProcessor "com.google.dagger:dagger-compiler:${DAGGER_DEPENDENCY_VERSION}"
provided "javax.annotation:jsr250-api:${JAVAX_ANNOTATION_JSR250_API_DEPENDENCY_VERSION}"
// Event bus
compile "org.greenrobot:eventbus:${GREEN_ROBOT_EVENT_BUS_DEPENDENCY_VERSION}"
// RxJava a library for composing asynchronous and event-based programs by using observable sequences.
compile "io.reactivex.rxjava2:rxjava:${RX_JAVA_DEPENDENCY_VERSION}"
compile "io.reactivex.rxjava2:rxandroid:${RX_ANDROID_JAVA_DEPENDENCY_VERSION}"
}
You can simply create your task that will depend on three different tasks. It's possible to have dependencies across subprojects as well:
task myAllTask {
}
myAllTask.dependsOn assembleDebug, publish, compileJava
For running tasks from subprojects:
myAllTask.dependsOn ':bootProj:assembleDebug', ':javaProj:publish', ':androidProj:compileJava
I am trying to build a basic app using Kotlin/Anko but I am getting the following duplicate file exception
Execution failed for task
':app:transformResourcesWithMergeJavaResForDebug'.>
com.android.build.api.transform.TransformException:
com.android.builder.packaging.DuplicateFileException: Duplicate files
copied in APK kotlin/internal/internal.kotlin_builtins File1:
C:\Users\mahesh.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-runtime\1.0.6.\3562c66f648480d3bd4f76cff722488ced13445b\kotlin-runtime-1.0.6.jar File2:
C:\Users\mahesh.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-compiler-embeddable\1.0.6\4008eb91a337b377dae7e4572b8b543e5321f549\kotlin-compiler-embeddable-1.0.6.jar
Following is the code for the app level gradle file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
buildscript {
ext.kotlin_version = '1.0.6'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
repositories {
jcenter()
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.kotlin.androdikotlinexample"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
//kotlin
compile "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
//anko
compile "org.jetbrains.anko:anko-design:0.8.3"
compile "org.jetbrains.anko:anko-support-v4:0.8.3"
compile "org.jetbrains.anko:anko-sdk15:0.8.3"
compile 'org.jetbrains.anko:anko-appcompat-v7:0.8.3'
}
Following is the code for Project level gradle file:
buildscript {
ext.kotlin_version = '1.0.6'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// 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 basic code for the MainUI file
class MainUI : AnkoComponent<MainActivityKotlin> {
override fun createView(ui: AnkoContext<MainActivityKotlin>): View = with(ui) {
coordinatorLayout {
verticalLayout {
// maybe put some content here
}
floatingActionButton {
imageResource = android.R.drawable.ic_menu_edit
onClick {
ui.owner.startActivityForResult<MainActivityKotlin>(1)
}
}.lparams {
gravity = Gravity.BOTTOM or Gravity.END
}
}
}
}
And the content is set on MainActivityKotlin file using the method MainUI().setContentView(this) in its onCreatemethod.
I have tried deleting the gradle cache and building the project again but nothing works. Please let me know where am I going wrong?
Remove compile "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version" from your gradle
Remove also all buildscript section from you app level gradle
Try this one:
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile ("org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version") {
transitive = false
}
Also you don't need the android-extensions dependency anymore, as it's bundled into the plugin. Just having the apply plugin: 'kotlin-android-extensions' in your gradle is enough.
The error i got is:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzqr.class
I have been stuck for hours on this issue.
Here is my Build.Gradle (app file) .
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
buildscript {
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "org.my.app"
minSdkVersion 19
targetSdkVersion 23
versionCode 140
versionName "1.4.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:7.0.0'
// Android SDK
compile 'com.facebook.android:facebook-android-sdk:4.+'
// Audience Network SDK. Only versions 4.6.0 and above are available
compile 'com.facebook.android:audience-network-sdk:4.+'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile 'com.facebook.fresco:fresco:0.9.0+'
compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.2#aar') {
transitive = true;
}
}
crashlytics {
enableNdk true
androidNdkOut 'src/main/obj'
androidNdkLibsOut 'src/main/libs'
}
You are adding the same class with different versions twice.
You are using the Google play services modules with different releases:
Use:
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
I am using this library https://github.com/mikepenz/MaterialDrawer
when I try run my project I get the following error:
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_31.jdk/Contents/Home/bin/java''
finished with non-zero exit value 2
If I try use jdk1.7
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.7.0_45\bin\java.exe'' finished with
non-zero exit value 2
Here is my build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.test"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.google.code.gson:gson:2.3'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile fileTree(dir: 'libs/httpclient', include: ['*.jar'])
compile 'com.afollestad:material-dialogs:0.7.6.0'
compile 'com.blunderer:materialdesignlibrary:2.0.0'
compile 'com.github.navasmdc:MaterialDesign:1.5#aar'
//https://github.com/mikepenz
compile('com.mikepenz:materialdrawer:3.1.2#aar') {
transitive = true
}
compile('com.mikepenz:aboutlibraries:5.0.7#aar') {
transitive = true
}
compile('com.crashlytics.sdk.android:crashlytics:2.4.0#aar') {
transitive = true;
}
}
I also tries these solutions, but it does not work:
defaultConfig {
...
multiDexEnabled = true
}
and
dependencies {
...
compile 'com.android.tools.build:gradle:1.1.2'
...
}
Your issue should be fixed by specifying -
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
You can read more about it at 65K Method Limit