Android Studio 分包配置
来源:互联网 发布:网络推广做什么的 编辑:程序博客网 时间:2024/05/29 23:24
第一步:
在build.gradle文件中加上这两行代码
multiDexEnabled true
compile ‘com.android.support:multidex:1.0.1’
android { compileSdkVersion 24 buildToolsVersion "24.0.2" defaultConfig { applicationId "com.xh.animationdemo" minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }}dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:24.2.1' testCompile 'junit:junit:4.12' compile 'com.android.support:multidex:1.0.1'}
第二步:
在Mainfest的application中加上这行代码
android:name=”android.support.multidex.MultiDexApplication”
如果有自定义的application,就加上自己的:
android:name=”com.xh.animationdemo.MyApplication”
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.xh.animationdemo"> <application android:name="com.xh.animationdemo.MyApplication" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application></manifest>
第三步:
在自定义的application中重写attachBaseContext();并调用MultiDex.install(this);
public class MyApplication extends Application { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); }}注意事项:1、attachBaseContext()是在ContextWrapper类中的。而MultiDexApplication继承Application,就是如第二步一样重写了attachBaseContext()方法。2、不需要另外在libs中添加android-support-multidex.jar,否则会报异常。
0 0
- Android Studio分包配置
- Android Studio 分包配置
- Android Studio multidex分包笔记
- Android Studio 对资源分包
- android studio 初步的dex分包应用
- Android Studio下对资源进行分包
- Android Studio下对资源进行分包
- android studio 的layout 分包机制
- Android Studio下对资源进行分包
- Android Studio中Dex分包方案
- android studio很简单的资源分包
- Android Studio下对资源进行分包
- Android studio项目资源文件分包
- Android Studio 下对资源进行分包
- Android Studio下对资源进行分包
- android分包
- android分包
- android分包
- 解决新建Xamarin.Forms项目,编译Android项目时出错的问题
- Android自动清理 无用 多余 未引用 未关联资源工具
- 简单的工具类,判断手机号码是否合法,密码、验证码格式
- JVM内存溢出
- SRM146_DIV2
- Android Studio 分包配置
- Eclipse的简单安装
- java实现FTP多线程断点续传,上传下载!
- Web App和Native App 谁将是未来
- android入门开发之linux文件权限(六)
- JAVA中static的作用
- 浅谈HTTP中Get与Post的区别
- NOIP2016初赛总结
- Android版 RTSP客户端 ffmpeg