2016-03-06 55 views
2

我的項目在Java類和許多xml文件中有許多字符串。我使用Multidex這一點,但是當我試圖建立一個APK我得到這個錯誤:Android Studio錯誤:太多常量

Information:Gradle tasks [:app:assembleDebug] 
:app:preBuild UP-TO-DATE 
:app:preDebugBuild UP-TO-DATE 
:app:checkDebugManifest 
:app:preReleaseBuild UP-TO-DATE 
:app:prepareComAndroidDatabindingAdapters10Rc5Library UP-TO-DATE 
:app:prepareComAndroidDatabindingLibrary10Rc5Library UP-TO-DATE 
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportV42300Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesAds840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE 
:app:prepareDebugDependencies 
:app:compileDebugRenderscript UP-TO-DATE 
:app:generateDebugResValues UP-TO-DATE 
:app:generateDebugResources UP-TO-DATE 
:app:mergeDebugResources UP-TO-DATE 
:app:dataBindingProcessLayoutsDebug UP-TO-DATE 
:app:compileDebugAidl UP-TO-DATE 
:app:generateDebugBuildConfig UP-TO-DATE 
:app:generateDebugAssets UP-TO-DATE 
:app:mergeDebugAssets UP-TO-DATE 
:app:processDebugManifest UP-TO-DATE 
:app:processDebugResources UP-TO-DATE 
:app:generateDebugSources UP-TO-DATE 
:app:dataBindingExportBuildInfoDebug UP-TO-DATE 
:app:compileDebugJavaWithJavac 
C:\WoW17\WoW17\app\build\generated\source\r\debug\com\xxx\test\R.java 
Error:(12127, 25) error: too many constants 
Error:Execution failed for task ':app:compileDebugJavaWithJavac'. 
> Compilation failed; see the compiler error output for details. 
Information:BUILD FAILED 
Information:Total time: 3 mins 5.842 secs 
Information:2 errors 

我gradle這個文件:

apply plugin: 'com.android.application' 
android { 
    compileSdkVersion 21 
    buildToolsVersion "23.0.2" 

    defaultConfig { 
     applicationId "com.xxx.test" 
     minSdkVersion 14 
     targetSdkVersion 23 
     versionCode 13 
     versionName "1.66" 
     multiDexEnabled true 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    dataBinding { 
     enabled = true 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.google.android.gms:play-services-ads:8.4.0' 
    compile 'com.mcxiaoke.volley:library:1.0.19' 
    compile 'com.android.support:multidex:1.0.0' 

} 

我以前用過Eclipse,但我不能」 t multidex,所以這就是爲什麼我切換到使用Android Studio。我有35000個字符串,也是xml和Java文件。有沒有解決這個問題的方法?

+0

* 35K串*?在'strings.xml'中聲明? – Blackbelt

+1

是的,支持x7語言 – naber

回答