现在的位置: 首页 > Android > 正文

Reduce APK Size build by android studio

2018年02月27日 Android ⁄ 共 961字 暂无评论 ⁄ 被围观 14+

Reduce apk size build by android studio(build.gradle, AndroidManifest.xml):

1. build.gradle
android {
  compileSdkVersion 27
  defaultConfig {
    applicationId "reduce.apk.size"
    minSdkVersion 8
    targetSdkVersion 18
    versionCode 1
    versionName "1.0"
  }
  buildTypes {
    release {
      minifyEnabled true
      shrinkResources true
      zipAlignEnabled true
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
  ...
}
dependencies {
  implementation fileTree(include: ['*.jar'], dir: 'libs')
  //use support-v4,not v7
  implementation 'com.android.support:support-v4:27.0.1'
}
2. AndroidMenifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
  xmlns:tools="http://schemas.android.com/tools" 
  package="reduce.apk.size" android:versionCode="1" android:versionName="1.0">
  <uses-sdk tools:overrideLibrary="android.support.v4, android.support.fragment, android.support.mediacompat, android.support.coreutils, android.support.coreui, android.support.compat"/>
  ...

给我留言

您必须 [ 登录 ] 才能发表留言!

×
#