重命名程序包后,我的项目在android中构建时显示错误 [英] After renaming package my project showing error while building in android
问题描述
重命名程序包后,我的项目在android中构建时显示错误.
After renaming package my project showing error while building in android.
我使用了以下方法: Android Studio重命名程序包重命名了我的项目,之后,它开始出现以下错误:
I used this: Android Studio Rename Package for renaming my project and after that it started getting these errors:
Error:The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
然后我使用了 https://developer.android.com/tools/building/multidex.html 解决第一个错误,但这也没有用.
then i used https://developer.android.com/tools/building/multidex.html for resolving first error but that also didn't work.
所以我重新启动了Android Studio,然后再次尝试构建,但是发生了相同的错误.
So i restarted Android Studio and then again tried to build but same error occured.
然后,我尝试撤消回旧的程序包名称,但没有任何反应... 请帮忙!...
then i tried to undo back to old package name but nothing good happened..... please help!...
先谢谢了……
推荐答案
首先在代码下方添加build.gradle
dependencies {//just add below one in dependency
compile 'com.android.support:multidex:1.0.0' ....//no change your old jar file.....}
然后
android {
compileSdkVersion 24
buildToolsVersion '24.0.1'
defaultConfig {
applicationId "your pkg name"
minSdkVersion 15
targetSdkVersion 24
versionCode 6
versionName "v2.5.2.2"
multiDexEnabled true // just add it
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
dexOptions { //add it
javaMaxHeapSize "4g"
}}
清单文件中
<application
android:name=".Education_multidex" //add what ur create java file
android:allowBackup="true"
android:icon="@drawable/rvms_education_luncher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"> ....</application>
然后创建并添加一个Java文件,例如Education_multidex.java
public class Education_multidex extends MultiDexApplication {/* @Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}*/}
最终构建您的应用,然后在上述java文件中添加导入一些lib
这篇关于重命名程序包后,我的项目在android中构建时显示错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!