What is wrong? I can't compile project and get error:
Error:Execution failed for task ':app:transformClassesWithDexForGoogleDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --force-jumbo --num-threads=4 --multi-dex --main-dex-list C:\Users\andre\Desktop\MYproject\app\build\intermediates\multi-dex\google\debug\maindexlist.txt --output C:\Users\andre\Desktop\MYproject\app\build\intermediates\transforms\dex\google\debug\folders\1000\1f\main C:\Users\andre\Desktop\MYproject\app\build\intermediates\transforms\jarMerging\google\debug\jars\1\1f\combined.jar}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.firebase.firebase-perf'
android {
compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
applicationId "com.gvarani.myproject"
minSdkVersion 17
targetSdkVersion 26
versionCode 15
versionName "1.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true //important
}
useLibrary 'org.apache.http.legacy'
signingConfigs {
release
}
buildTypes {
debug {
minifyEnabled false
shrinkResources false
}
release {
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
getDefaultProguardFile('proguard-android-optimize.txt'),
'proguard/proguard-project.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
flavorDimensions "release"
productFlavors {
google {
dimension "release"
}
other {
dimension "release"
}
}
dexOptions {
javaMaxHeapSize "2g"
jumboMode true
}
}
ext {
supportLibVersion = '26.0.0'
gmsVersion = '11.0.4'
}
dependencies {
googleCompile "com.google.firebase:firebase-crash:${gmsVersion}"
googleCompile "com.google.firebase:firebase-messaging:${gmsVersion}"
googleCompile "com.google.firebase:firebase-auth:${gmsVersion}"
googleCompile 'com.anjlab.android.iab.v3:library:1.0.42'
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:cardview-v7:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
compile "com.android.support:customtabs:${supportLibVersion}"
compile "com.google.firebase:firebase-perf:${gmsVersion}"
compile "com.google.firebase:firebase-database:${gmsVersion}"
compile "com.google.firebase:firebase-ads:${gmsVersion}"
compile 'com.firebaseui:firebase-ui-auth:2.2.0'
compile 'com.firebaseui:firebase-ui-database:2.2.0'
compile 'com.google.code.gson:gson:2.8.1'
compile 'dev.dworks.libs:volleyplus:0.1.4'
compile 'cat.ereza:customactivityoncrash:2.1.0'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
compile 'org.fabiomsr:moneytextview:1.1.0'
compile 'com.zsoltsafrany:needle:1.0.0'
compile 'com.github.lykmapipo:local-burst:v0.2.0'
compile 'com.github.javiersantos:AppUpdater:2.6.1'
compile 'de.psdev.licensesdialog:licensesdialog:1.8.2'
compile 'org.jsoup:jsoup:1.10.3'
compile 'com.wordplat:ikvStockChart:0.1.5'
compile 'com.android.support:multidex:1.0.0'
//Kotlin dependencies
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services
Please try below code
android{
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
//...
compile 'com.android.support:multidex:1.0.0'
}
**Hope this will help **
Put below line in build.gradle;
multiDexEnabled true
like this:
defaultConfig
{
applicationId "yourProjectPackage"
minSdkVersion 15
versionCode 1
versionName "1.0"
targetSdkVersion 23
multiDexEnabled true //important
}
add follow code in your manifest.xml file:
<application
android:name="android.support.multidex.MultiDexApplication">
</application>
Add below lines to your app build.gradle
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Add maven { url "https://maven.google.com" } in Project level gradle
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Related
I am migrating our project to the Gradle 3.0 plugin, I am going error by error a I am new in Gradle.
Now, I am facing this issue:
Error:Could not determine the dependencies of task ':ComponentsLib:mergeProdReleaseResources'.
> Could not resolve all task dependencies for configuration ':ComponentsLib:prodReleaseRuntimeClasspath'.
> Could not resolve project :Datastore.
Required by:
project :ComponentsLib
> Project :ComponentsLib declares a dependency from configuration 'releaseCompile' to configuration 'prodRelease' which is not declared in the descriptor for project :Datastore.
Here is the gradle.build for ComponentLib module:
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
flavorDimensions "default"
publishNonDefault true
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
}
}
productFlavors {
internal {
minSdkVersion rootProject.ext.debugMinSdkVersion
}
prod {
}
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "2g"
}
lintOptions {
quiet false
warningsAsErrors true
abortOnError true
checkReleaseBuilds false
textReport = true
htmlReport = false
xmlReport = false
ignore(rootProject.ext.lintIgnore as String[])
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
debugCompile project(path: ':Datastore', configuration: 'internalDebug')
releaseCompile project(path: ':Datastore', configuration: 'prodRelease')
}
And here is the gradle.build for Datastore module:
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
flavorDimensions "default"
publishNonDefault true
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
}
}
productFlavors {
internal {
minSdkVersion rootProject.ext.debugMinSdkVersion
}
prod {
}
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "2g"
}
lintOptions {
quiet false
warningsAsErrors true
abortOnError true
checkReleaseBuilds false
textReport = true
htmlReport = false
xmlReport = false
ignore(rootProject.ext.lintIgnore as String[])
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
debugCompile project(path: ':Core', configuration: 'internalDebug')
releaseCompile project(path: ':Core', configuration: 'prodRelease')
}
The modules are build in order -> ':Core', ':Datastore', ':ComponentsLib', ':Push',....
Any idea what is happening here?
Thanks.
I finally fixed it.
Porblem was that I had to rewrite
debugCompile project(path: ':Datastore', configuration: 'internalDebug')
releaseCompile project(path: ':Datastore', configuration: 'prodRelease')
to
instalation project(':Datastore')
because the new Gradle 3.0 plugin manages build process in the different way.
Below is my build.gradle file for app.
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' }
google()
}
android {
signingConfigs {
liveSigning {
keyAlias 'xxxxxxx'
keyPassword 'xxxxxx'
storeFile file('D:\\xxxxx\\xxxxxxx\\xxxxx\\xxxx.jks')
storePassword 'xxxxxxx'
}
}
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
useLibrary 'org.apache.http.legacy'
sourceSets.main {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [];
}
defaultConfig {
applicationId rootProject.ext.applicationId
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.compileSdkVersion
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
multiDexEnabled true
resConfigs "en"
vectorDrawables.useSupportLibrary true
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.liveSigning
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
task ndkBuild(type: Exec) {
commandLine rootProject.ext.ndkPath, '-C', file('src/main').absolutePath
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
lintOptions {
abortOnError false
}
productFlavors {
live {
minSdkVersion rootProject.ext.minSdkVersion
applicationId rootProject.ext.applicationId
signingConfig signingConfigs.liveSigning
targetSdkVersion rootProject.ext.compileSdkVersion
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
resConfigs "en"
}
}
flavorDimensions "default"
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//compile files('libs/gson-2.2.4.jar')
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
compile "com.android.support:cardview-v7:${rootProject.ext.supportLibVersion}"
compile "com.android.support:design:${rootProject.ext.supportLibVersion}"
compile files('libs/cordova-5.jar')
compile files('libs/org.apache.commons.io.jar')
compile files('libs/httpmime-4.2.3.jar')
compile files('libs/jsoup-1.7.3.jar')
compile files('libs/activation.jar')
compile project(':libraries:EventBus')
compile project(':libraries:PDFViewCtrlTools')
compile project(':libraries:imageannotations')
compile project(':libraries:bottom-bar')
compile project(':libraries:tooltip')
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
compile files('libs/glide-3.6.1.jar')
//compile 'com.roughike:bottom-bar:2.2.0'
compile project(':libraries:k4l-video-trimmer')
compile 'com.android.support:multidex:1.0.1'
compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.0.1'
compile 'com.google.firebase:firebase-messaging:10.2.0'
compile 'me.relex:circleindicator:1.2.2'
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile 'org.apache.commons:commons-collections4:4.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
apply plugin: 'com.google.gms.google-services'
Before I generate signed APK to upload for google play store , I want to execute command line code. And by using that command line program i want to do some pre release activity like disable logs of NDK, change url to live website and etc. So how can I execute it before assembleLive or assembleRelease ? I don't want to execute that command line code before "assembleDebug". I want to execute it only before "assembleLive or assembleRelease".
I added below code to my gradle file and it works like a charm.
task prelivetask (type: Exec) {
commandLine 'cmd','/C', 'start', 'change.cmd'
}
tasks.whenTaskAdded { task ->
if (task.name == 'assembleRelease' || task.name == 'assembleLive') {
task.dependsOn prelivetask
}
}
I imported GoogleMapsV2WithActionBarSherlock eclipse project and encountered
Error:Execution failed for task ':googleMapsV2:processDebugManifest'.
Manifest merger failed : Attribute meta-data#com.google.android.gms.version#value value=() from
[GoogleMapsV2WithActionBarSherlock:androidmapsutils:unspecified]
AndroidManifest.xml:8:13-29 is also present at
[com.google.android.gms:play-services-basement:11.0.2]
AndroidManifest.xml:20:66-119
value=(#integer/google_play_services_version). Suggestion: add
'tools:replace="android:value"' to element at
AndroidManifest.xml:6:9-8:32 to override.
Is anybody has a clue on what it is and how can I fix it?
Here are the list of the errors.
googleMapsV2 build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.ecs.google.maps.v2.actionbarsherlock"
minSdkVersion 14
targetSdkVersion 17
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':androidmapsutils')
compile project(':library')
compile 'com.google.code.gson:gson:2.1'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'com.android.support:support-v4:18.0.0'
compile 'com.android.support:gridlayout-v7:18.0.0'
compile 'com.google.android.gms:play-services:+'
compile files('libs/commons-logging-1.1.1.jar')
compile files('libs/google-http-client-1.15.0-rc.jar')
compile files('libs/google-http-client-android-1.15.0-rc.jar')
compile files('libs/google-http-client-jackson2-1.15.0-rc.jar')
compile files('libs/httpclient-4.0.1.jar')
compile files('libs/httpcore-4.0.1.jar')
compile files('libs/jackson-core-2.1.3.jar')
compile files('libs/jackson-core-asl-1.9.11.jar')
}
androidmaputils build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:21.0.0'
compile 'com.google.android.gms:play-services-maps:11.0.2'
}
GoogleMapsV2WithActionBarSherlock 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:2.2.0'
}
}
allprojects {
repositories {
jcenter()
}
}
PagerTabSlidingTabStrip build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 17
buildToolsVersion "26.0.0"
defaultConfig {
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
}
Check your build.gradle(app) minSdkVersion 14 and
compile 'com.google.android.gms:play-services-maps:11.0.2'
add tools:replace="android:value" to your manifest to the end of <application> tag
I have possibly tried all the solutions regarding this issue.
The full error is: Error:Execution failed for task "
':app:transformClassesWithDexForDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1
"
I am posting my build.gradle scripts:
Script name: RajawaliCardBoardExample-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:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
name: Module:app >>
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
dexOptions {
incremental true
javaMaxHeapSize "4g"
jumboMode = true
}
defaultConfig {
applicationId "com.eje_c.rajawalicardboard"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':rajawalicardboard')
compile project(':lib_panorama_max')
compile 'com.android.support:multidex:1.0.1'
}
name: Module:lib_panorama_max >>
apply plugin: 'java'
task nativeLibsToJar(type: Zip, description: 'create a jar archive of the native libs') {
destinationDir file("$buildDir/native-libs")
baseName 'native-libs'
extension 'jar'
from fileTree(dir: 'libs', include: '**/*.so')
into 'lib/'
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn(nativeLibsToJar)
options.encoding = "UTF-8"
options.debug = true
options.debugOptions.debugLevel = "source,lines,vars"
options.encoding = "UTF-8"
}
dependencies {
compile files('libs/commons-httpclient-3.1.jar')
compile files('libs/android.jar')
compile fileTree(dir: 'build/native-libs', include: ['*.jar'])
}
name: Module:Rajawali >>
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
dexOptions {
incremental true
javaMaxHeapSize "2048M"
jumboMode = true
}
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
name: Module:rajawalicardboard >>
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
dexOptions {
incremental true
javaMaxHeapSize "2048M"
jumboMode = true
}
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':rajawali')
}
Please help to sort it out! :(
At first you should add
defaultConfig
{
// Enabling multidex support.
multiDexEnabled true
}
Open Module:app .You missing multiDexEnabled true in here .
defaultConfig {
applicationId "com.eje_c.rajawalicardboard"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
Read Official Document about MultiDex
The option 1 was adding multiDexEnabled true
But you told it didn't work at all, you can try excluding group group: 'com.android.support', module: 'multidex' now which means in the compilation for example change
compile project(':rajawalicardboard')
To
compile project(':rajawalicardboard'){
exclude group: 'com.android.support', module: 'multidex'
}
Don't only try on this, do the same in compile project(':lib_panorama_max') if only the changes above didn't work. Try removing compile 'com.android.support:multidex:1.0.1' too.
I'm trying to build an application. But it failed in Release when I set the minifyEnabled to true. Here is the error message:
:app:parseUploadSymbolsRelease FAILED
Error:Execution failed for task ':app:parseUploadSymbolsRelease'.
android/app/build/outputs/mapping/release/mapping.txt (No such file or directory)
My build.grade:
apply plugin: 'com.android.application'
android {
signingConfigs {
release {
keyAlias 'mykey'
keyPassword 'mypass'
storeFile file('keystore')
storePassword 'mypass'
}
}
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.company.app"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
signingConfig signingConfigs.release
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
proguardFile 'proguard-rules.pro'
debuggable false
minifyEnabled true
}
debug {
debuggable true
proguardFile 'proguard-rules.pro'
minifyEnabled false
}
}
}
repositories {
maven { url 'file:////Users/Shared/Mylib/AarRepository' }
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile files('libs/ParseCrashReporting-1.8.3.jar')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'
compile 'com.android.support:cardview-v7:21.0.3'
compile 'com.facebook.android:facebook-android-sdk:3.23.+'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.jakewharton:disklrucache:2.0.2'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.company.library:company-library:1.0.4#aar'
compile 'com.parse.bolts:bolts-android:1.+'
compile files('libs/YouTubeAndroidPlayerApi.jar')
}
// to enable auto load of symbol file for crash report
buildscript {
repositories {
mavenCentral()
maven {
url 'https://maven.parse.com/repo'
}
}
dependencies {
classpath 'com.parse.tools:gradle:1.+'
}
}
apply plugin: 'com.parse'
parse {
applicationId "myappid"
masterKey "mymasterkey"
uploadSymbols = ['release']
retries 3
}
How to solve this? Can anybody help? Thanks