When I run my project in android studio , it takes long to compile,
it usually requires 3 - 5 minutes.
In Gradle Console it stopping long time in: :app:dexDebug
How can I reduce the time ???
my bulild.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "it.unical.mat.myapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile files('libs/activation.jar')
compile files('libs/gdata-analytics-2.1.jar')
compile files('libs/gdata-core-1.0.jar')
compile files('libs/gdata-spreadsheet-3.0.jar')
compile files('libs/jsr305.jar')
compile files('libs/mail.jar')
compile files('libs/guava-18.0.jar')
}
Related
Completely I was created an Android app. Now this app on playstore. Problem is, some users are review that they can't open this app. This app will stopped after splash. but my phone and android emulator working fine. but while I will change the gradle build version it results the users reviews. it's really stopped. now i want to solve this problems and so tried. please explain me how to solve this error issue.?
my first gradle file working. but second gradle file fetching this problem.
first
gradle.build
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "net.gurujibd.test"
minSdkVersion 12
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:recyclerview-v7:24.0.+'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.jakewharton:butterknife:8.8.1'
compile 'com.squareup.picasso:picasso:2.5.0'
compile files('libs/awais.jar')
compile 'com.android.support:support-vector-drawable:24.2.1'
compile 'com.android.support:multidex:1.0.1'
compile project(':dBPullToRefresh')
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
2nd gradle
gradle.build
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "net.gurujibd.test"
minSdkVersion 15
targetSdkVersion 28
versionCode 3
versionName "1.2"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:28.0.0-beta01'
implementation 'com.android.support:design:28.0.0-beta01'
implementation 'com.android.support:recyclerview-v7:28.0.0-beta01'
implementation 'com.android.volley:volley:1.0.0'
implementation 'com.google.android.gms:play-services:10.0.1'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.squareup.picasso:picasso:2.5.0'
implementation files('libs/awais.jar')
implementation 'com.android.support:support-vector-drawable:28.0.0-beta01'
implementation 'com.android.support:multidex:1.0.1'
implementation project(':dBPullToRefresh')
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation "com.android.support:support-v4:+"
}
dBPullToRefresh
gradle.build
apply plugin: 'com.android.library'
android {
compileSdkVersion 16
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 4
targetSdkVersion 4
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
}
Error
java.util.concurrent.ExecutionException: com.google.android.apps.gsa.sidekick.main.h.n: Could not complete scheduled request to refresh entries. ClientErrorCode: 3
at com.google.common.util.concurrent.d.eA(SourceFile:85)
at com.google.common.util.concurrent.d.get(SourceFile:23)
at com.google.common.util.concurrent.l.get(SourceFile:2)
at com.google.android.apps.gsa.staticplugins.nowstream.b.a.be.cbB(SourceFile:49)
at com.google.android.apps.gsa.staticplugins.nowstream.b.a.be.cbA(SourceFile:181)
at com.google.android.apps.gsa.staticplugins.nowstream.b.a.bh.run(Unknown Source:2)
at com.google.android.apps.gsa.shared.util.concurrent.at.run(SourceFile:4)
Please do the following and tell me if this resolved the issue.
First, change
buildToolsVersion '27.0.3'
to
buildToolsVersion '28.0.0'
Then, change these lines of code
implementation 'com.android.support:appcompat-v7:28.0.0-beta01'
implementation 'com.android.support:design:28.0.0-beta01'
implementation 'com.android.support:recyclerview-v7:28.0.0-beta01'
implementation 'com.android.support:support-vector-drawable:28.0.0-beta01'
with these lines of code
implementation 'com.android.support:appcompat-v7:28.0.+'
implementation 'com.android.support:design:28.0.+'
implementation 'com.android.support:recyclerview-v7:28.0.+'
implementation 'com.android.support:support-vector-drawable:28.0.+'
Now press Sync Now and run your code.
PS: Android Studio might prompt you to download certain packages if they are not readily available, just allow it to do so.
Are you sure that the problem is from Gradle? use crash reporters like fabric.io
somebody can tell me, why Android Studio 3.0.1, show me this error when make app?
Execution failed for task ':joy-android-game-gdx:transformDexArchiveWithExternalLibsDexMergerForDebugAndroidTest'.
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
The next attach *my build gradle**
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.websmithing.gpstracker"
minSdkVersion 15
targetSdkVersion 25
versionCode 15
versionName "4.0.5"
}
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:25.0.0'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.loopj.android:android-async-http:1.4.9'
}
the app compila when i delete this line:
compile 'com.android.support:appcompat-v7:25.0.0'
but the app after moment automatic close
Try
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.websmithing.gpstracker"
minSdkVersion 15
targetSdkVersion 25
versionCode 15
versionName "4.0.5"
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:appcompat-v7:25.0.0'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.android.support:multidex:1.0.2'
}
Beside this, please review your dependency versions. They are not the latest versions and you might want to update them. Take care of the buildToolsVersion as well.
Can't build project with Dagger 2 (Android Studio 1.3).
Step 1. Add dependencies to build.gradle
apt 'com.google.dagger:dagger-compiler:2.0'
compile 'com.google.dagger:dagger:2.0'
provided 'org.glassfish:javax.annotation:10.0-b28'
Full build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
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.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:design:22.2.+'
compile 'com.android.support:palette-v7:22.2.+'
compile 'com.afollestad:material-dialogs:0.7.8.1'
apt 'com.google.dagger:dagger-compiler:2.0'
compile 'com.google.dagger:dagger:2.0'
compile 'org.androidannotations:androidannotations:3.0.+'
compile 'org.androidannotations:androidannotations-api:3.0.+'
provided 'org.glassfish:javax.annotation:10.0-b28'
compile files('libs/gson-2.2.jar')
}
Step 2.
Just add annotation #Inject or #Module to code and get compile error.
Error:Execution failed for task ':app:compileDebugJava'.
java.lang.NoSuchMethodError: com.google.common.collect.Multimaps.filterKeys(Lcom/google/common/collect/SetMultimap;Lcom/google/common/base/Predicate;)Lcom/google/common/collect/SetMultimap;
Any ideas?
Update
I'm create new project.
build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 22
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.2.1'
apt 'com.google.dagger:dagger-compiler:2.0'
compile 'com.google.dagger:dagger:2.0'
provided 'org.glassfish:javax.annotation:10.0-b28'
compile files('libs/gson-2.2.jar')
}
And it compile fine. When I add to libs guava-r07.jar I get like compile error. I think the problem relate with guava.
Solved
Remove guava-r07.jar from libs.
Add to build.gradle
compile 'com.google.guava:guava:13.0.1'
I'm getting the following error when I build my application in Android:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: oauth/signpost/http/HttpResponse.class
My build.gradle looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.me.hey"
minSdkVersion 8
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.semantics3:Sem3Java:1.2.2'
compile files('libs/Sem3Java-1.2.2-jar-with-dependencies.jar')
compile 'com.android.support:multidex:1.0.0'
}
Any ideas on what I might be doing wrong?
I add a library to my project,but the library has some jar packages that i have used in my app,so it comes out the error "finished with non-zero value 2",after i modify the jar packages version,it comes out the error "Error:Execution failed for task ':app:preDexDebug'. > ... finished with non-zero value 1",i dont konw how to solve it 。
the app buidle.gradle :
`apply plugin: 'com.android.application'
android {
packagingOptions{
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
lintOptions {
abortOnError false
}
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.fengmanlou.logintest"
minSdkVersion 14
targetSdkVersion 21
versionCode 2
versionName "2.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:22.0.0'
compile project(':slibingtab')
compile project(':leanchatlib')
compile files('libs/weibo.sdk.android.sso.jar')
compile files('libs/Java-WebSocket-1.2.0-leancloud.jar')
compile files('libs/qq.sdk.1.6.1.jar')
compile files('libs/httpmime-4.2.4.jar')
compile files('libs/fastjson-1.1.37-leancloud.jar')
compile files('libs/avoscloud-statistics-v3.1.1.jar')
compile files('libs/avoscloud-sdk-v3.1.4.jar')
compile files('libs/avoscloud-push-v3.1.4.jar')
compile files('libs/android-async-http-1.4.6.jar')
compile files('libs/android_api_1.1_forsdk.jar')
compile files('libs/BaiduLBS_Android.jar')
compile files('libs/galaxy_mini.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/avoscloud-sns-v3.1.1.jar')
compile files('libs/avoscloud-search-v3.1.1.jar')
compile files('libs/weibosdkcore.jar')
compile files('libs/litepal.xml-1.2.0.jar')
compile project(':pulltorefresh')
compile files('libs/avoscloud-feedback-v3.1.1.jar')
compile files('libs/jsoup-1.8.1.jar')
compile project(':slibingmenu')
} `
the library build.gradle :
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
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:support-v4:22.0.0'
compile files('libs/android-async-http-1.4.6.jar')
compile files('libs/avoscloud-push-v3.1.4.jar')
compile files('libs/avoscloud-sdk-v3.1.4.jar')
compile files('libs/butterknife-6.1.0.jar')
compile files('libs/eventbus-2.4.0.jar')
compile files('libs/fastjson-1.1.37-leancloud.jar')
compile files('libs/httpmime-4.2.4.jar')
compile files('libs/Java-WebSocket-1.2.0-leancloud.jar')
compile files('libs/prettytime-3.2.5.Final.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
}
this is the first time i use stackoverflow to ash question,please tell me how to solve it .thank you!
I also dont know how to solve the problem.but the project is built successfully.There is a jar package that cant be opened. I delete it and add the jar package from other project.it works.