when i create values-v21 for android L' styles but when i cntrl+space for search there isn't any android L library.I checked android sdk manager,everything updated. and i'm using these library in build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "......."
minSdkVersion 13
targetSdkVersion 20
versionCode 3
versionName "1.1"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/commons-net-3.3-sources.jar')
compile files('libs/commons-net-3.3.jar')
compile files('libs/commons-net-examples-3.3.jar')
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.android.support:support-v4:20.0.0'
compile 'com.google.android.gms:play-services:3.1.+'
compile 'com.google.android.gms:play-services:5.2.08'
compile 'com.github.mrengineer13:snackbar:0.4.0'
}
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
you do not reference android L anywhere
your gradle should have these in it
compileSdkVersion 'android-L'
minSdkVersion 'L'
targetSdkVersion 'L'
Related
ERROR: Unable to find method
'org.gradle.api.tasks.compile.CompileOptions.setBootClasspath(Ljava/lang/String;)V'.
I tried to upgrade and downgrade the Gradle but getting the same error
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.micutu.locatedriver"
minSdkVersion 14
targetSdkVersion 24
versionCode 7
versionName "1.6"
}
buildTypes {
debug {
debuggable true
}
release {
debuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'io.nlopez.smartlocation:library:3.2.5'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.google.android.gms:play-services-places:9.2.1'
compile 'com.google.android.gms:play-services-location:9.2.1'
compile 'com.google.code.gson:gson:2.3'
}
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.
After creating a new project when I try to run the app it shows build failed error.
I searched for it on the internet, they say that it may be due to duplicate libraries of gradle or duplicate dependencies in gradle file, but it wasn't so In my case.
Here is my build.gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.naveenjain.ayusch"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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'
}
Try to delete this line:
compile fileTree(dir: 'libs', include: ['*.jar'])
Or you could set multiDexEnabled true:
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
and try again. Hope it helps.
Is it possible to have different build types for plain java libraries in Android Studio with gradle? My intention is to run proguard and minify the jar file size.
Java build.gradle
apply plugin: 'java'
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
}
Android build.gradle
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "test.app"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
}
productFlavors {
buildWithSingleAlarmFlavour {
applicationId "test.app"
versionName ".1"
}
buildWithMultipleAlarmFlavour {
applicationId "test.app"
versionName "0.1"
}
}
}
I followed the guide from this question: Android Studio - UNEXPECTED TOP-LEVEL EXCEPTION:
but it still refuses to compile correctly, I've tried looking for the duplicate entries but cannot find it, the error is as follows
Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\ShadowFox\Android-sdk\build-tools\21.1.1\dx.bat --dex --output C:\Work\SystemMonitor - version 4.0\app\build\intermediates\dex\debug --input-list=C:\Work\SystemMonitor - version 4.0\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v7/app/ActionBar$Callback;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)
at com.android.dx.command.dexer.Main.run(Main.java:245)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)
Then for my Module:app build.gradle I have
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "edu.fiu.cis.visa.systemmonitor"
minSdkVersion 19
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.2.0'
compile files('libs/dropbox-android-sdk-1.6.3.jar')
compile files('libs/httpmime-4.0.3.jar')
compile files('libs/json_simple-1.1.jar')
compile project(":libs:AndroidCommon")
}
and my library's build.gradle is as follows
apply plugin: 'com.android.library'
dependencies {
compile 'com.android.support:support-v4:21.0.3'
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
}
> sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/gson-2.2.2.jar')
compile files('libs/jackson-all-1.9.11.jar')
compile files('libs/RootTools-3.4.jar')
}
}
The library com.android.support:appcompat-v7 is fetched both times. Remove the first one.
You fetch the library, and then your library's build.gradle fetches it again
try this
in the app:build.gradle
defaultConfig {
applicationId "edu.fiu.cis.visa.systemmonitor"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
And put it in the app:build.gradle file
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
}
}