Here is the content of my build.gradle
file:
这是我的构建的内容。gradle文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven {
credentials {
username artifactoryUserName
password artifactoryPassword
}
url 'http://test:8081/artifactory/libs-release-local'
}
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
allprojects {
repositories {
maven {
credentials {
username artifactoryUserName
password artifactoryPassword
}
url 'http://test:8081/artifactory/libs-release-local'
}
mavenCentral()
maven { url 'http://repo1.maven.org/maven2' }
jcenter()
} }
Here is the content of app\build.gradle
:
这是app的内容。gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
lintOptions {
abortOnError false
}
defaultConfig {
applicationId "test.com"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
signingConfigs {
aseeConfig {
storeFile file("test.keystore")
storePassword "test123"
keyAlias "AndroidKey"
keyPassword "test123"
}
}
buildTypes {
release {
signingConfig signingConfigs.aseeConfig
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
prod.initWith(buildTypes.release)
prod {
signingConfig signingConfigs.aseeConfig
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
} }
dependencies {
//compile 'com.google.android:support-v4:r13'
compile 'com.google.android:google-play-services:4.1.32'
compile 'com.devsmart.android:devsmart-lib:1.0.0'
compile 'com.jeremyfeinstein.slidingmenu.lib:sliding-menu:1.0.0'
compile 'com.viewpagerindicator:viewpager-indicator:2.4.1'
///compile 'com.google.android.gms:google-play-services_lib:4.1.32'
compile 'com.emilsjolander:sticky-list-headers:1.0.0'
//compile 'com.actionbarsherlock:actionbar-sherlock:4.2.0'
compile 'com.mobeta.android.dslv:drag-sort-list-view:0.6.1'
compile 'com.threegvision.products:inigma_sdk_pro:3.24'
compile 'org.afree:a-free-chart:1.0.0'
compile 'org.afree:a-free-graphics:1.0.0'
compile 'net.simonvt:datepicker:1.0'
//compile 'eu.inmite:android-styled-dialogs:1.1'
compile 'com.nineoldandroids:nine-old-androids:2.4.1'
compile 'com.shinobicontrols.charts:shinobicharts:1.5.0-5'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.daimajia.slider:library:1.1.5@aar'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'com.journeyapps:zxing-android-embedded:3.0.1@aar'
compile 'com.google.zxing:core:3.2.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/actionbarsherlock-4.2.0.jar')
compile files('libs/android-styled-dialogs-1.1.1-sources.jar')
compile files('libs/android-support-4.0.jar')
}
I can't build my project . I am getting this error:
我无法建立我的项目。我得到了这个错误:
3 个解决方案
#1
0
I faced this kind of issue once but I don't remember exactly how to fix it.
As I rememeber, I follow this link
It's seem because there are many module dependent on difference support-v4 lib. So add multiDexEnabled true
may works.
我曾经遇到过这样的问题,但我不记得具体是怎么解决的。正如我所记得的,我遵循这个链接,因为有很多模块依赖于不同的supportv4 lib,所以添加multiDexEnabled true可以起作用。
Also try to set all modules' dependency to a same version of support-v4. You can look at these link to known how to exclude compile v4 link1 link2 link3
If it still doesn't work, try to clean project, restart Studio, even restart your computer(I don't know why but this worked for me once)
还要尝试将所有模块的依赖项设置为与supportv4相同的版本。你可以看看这些链接,知道如何排除编译v4 link1 link2,如果它仍然不工作,试着清理项目,重启工作室,甚至重启你的电脑(我不知道为什么,但这对我来说很有用)
Hope this helps.
希望这个有帮助。
#2
0
in your build.gradle file set your compileSdkVersion 20.0.0 and buildToolsVersion "21.0.0"
在您的构建。gradle文件设置您的编译版本20.0.0和buildToolsVersion“21.0.0”
#3
0
Generally, it is because of resource conflicts within your modules.For sample, there are two ic_launcher.png in your app.(one from module and one from your app)
通常,这是因为模块内的资源冲突。对于示例,有两个ic_launcher。png在你的应用程序中(一个来自模块,一个来自你的app)
I searched to check resource conflicts but I didn't find official solution.
我寻找资源冲突,但没有找到官方解决方案。
I only solved by this ways, remove each module and test it is being conflict or not. That's the simplest way to solve. I hope this will help you.
我只是用这种方法来解决,移除每个模块并测试它是否存在冲突。这是最简单的解。我希望这对你有帮助。
Here below are another suggestion....
这下面是另一个建议....
I found also this way, one person(I didn't remember name) use safe delete to check conflict.
我也发现这样,一个人(我不记得名字)使用安全删除来检查冲突。
And some Q&A said, to add multiDexEnabled:true. That config is to increase dex file size. You can also use multidex support library .
一些问答说,要添加multiDexEnabled:true。配置是增加dex文件的大小。您还可以使用multidex支持库。
The Dalvik Executable specification limits the total number of methods that can be referenced within a single DEX file to 65,536, including Android framework methods, library methods, and methods in your own code. Getting past this limit requires that you configure your app build process to generate more than one DEX file, known as a multidex configuration.
Dalvik可执行规范限制了单个DEX文件中可以引用的方法的总数为65,536,包括Android框架方法、库方法和代码中的方法。越过这个限制要求您配置您的应用程序构建过程,以生成多个DEX文件,称为多DEX配置。
Here is the link for multiDex:
https://developer.android.com/tools/building/multidex.html
这里是multiDex的链接:https://developer.android.com/tools/building/multidex.html。
But documentation said you should be careful to use that.
但是文档说明你应该小心使用它。
#1
0
I faced this kind of issue once but I don't remember exactly how to fix it.
As I rememeber, I follow this link
It's seem because there are many module dependent on difference support-v4 lib. So add multiDexEnabled true
may works.
我曾经遇到过这样的问题,但我不记得具体是怎么解决的。正如我所记得的,我遵循这个链接,因为有很多模块依赖于不同的supportv4 lib,所以添加multiDexEnabled true可以起作用。
Also try to set all modules' dependency to a same version of support-v4. You can look at these link to known how to exclude compile v4 link1 link2 link3
If it still doesn't work, try to clean project, restart Studio, even restart your computer(I don't know why but this worked for me once)
还要尝试将所有模块的依赖项设置为与supportv4相同的版本。你可以看看这些链接,知道如何排除编译v4 link1 link2,如果它仍然不工作,试着清理项目,重启工作室,甚至重启你的电脑(我不知道为什么,但这对我来说很有用)
Hope this helps.
希望这个有帮助。
#2
0
in your build.gradle file set your compileSdkVersion 20.0.0 and buildToolsVersion "21.0.0"
在您的构建。gradle文件设置您的编译版本20.0.0和buildToolsVersion“21.0.0”
#3
0
Generally, it is because of resource conflicts within your modules.For sample, there are two ic_launcher.png in your app.(one from module and one from your app)
通常,这是因为模块内的资源冲突。对于示例,有两个ic_launcher。png在你的应用程序中(一个来自模块,一个来自你的app)
I searched to check resource conflicts but I didn't find official solution.
我寻找资源冲突,但没有找到官方解决方案。
I only solved by this ways, remove each module and test it is being conflict or not. That's the simplest way to solve. I hope this will help you.
我只是用这种方法来解决,移除每个模块并测试它是否存在冲突。这是最简单的解。我希望这对你有帮助。
Here below are another suggestion....
这下面是另一个建议....
I found also this way, one person(I didn't remember name) use safe delete to check conflict.
我也发现这样,一个人(我不记得名字)使用安全删除来检查冲突。
And some Q&A said, to add multiDexEnabled:true. That config is to increase dex file size. You can also use multidex support library .
一些问答说,要添加multiDexEnabled:true。配置是增加dex文件的大小。您还可以使用multidex支持库。
The Dalvik Executable specification limits the total number of methods that can be referenced within a single DEX file to 65,536, including Android framework methods, library methods, and methods in your own code. Getting past this limit requires that you configure your app build process to generate more than one DEX file, known as a multidex configuration.
Dalvik可执行规范限制了单个DEX文件中可以引用的方法的总数为65,536,包括Android框架方法、库方法和代码中的方法。越过这个限制要求您配置您的应用程序构建过程,以生成多个DEX文件,称为多DEX配置。
Here is the link for multiDex:
https://developer.android.com/tools/building/multidex.html
这里是multiDex的链接:https://developer.android.com/tools/building/multidex.html。
But documentation said you should be careful to use that.
但是文档说明你应该小心使用它。