Android Studio Package Generation APK Tutorial

Source: Internet
Author: User

One Modify version and specify build apk filename "optional"

Switch items to Project View, open the build.gradle file in the app directory

1.1 RepairFixed softwareversion

Versioncode is the large version number of the app , which is the value type, default to 1 I change this to 2 .

Versionname is The specific version number of the app, for the inter-string type, the default is 1.0 I changed it here 2.0

1.2 Specifies the generated APK file name

is modified in the Build.gradle file, the default generated release version of the apk is named app-release.apk.

inside Android defaultconfig add content under the same layer (outputfilename change to the desired apk name)

Android.applicationVariants.all {

Variant-

Variant.outputs.all {

the generated apk file name is specified here

OutputFileName = "sectest.apk"

}

}

TwoEnable code obfuscation "optional"2.1 Enabling code obfuscation

is also in the build.gradle buildtypes/release/minifyenabled true false )

proguardfiles getdefaultproguardfile (' proguard-android.txt '), ' Proguard-rules.pro ' Specify the obfuscation rules to use where Proguard-android.txt Yes android default obfuscation rules (in $SDK _path , tools\proguard proguard-rules.pro proguard-rules.pro build.gradle file in the same sibling directory).

I only use the system default obfuscation rules here, so Proguard-rules.pro does not need to be modified either.

2.2 Verification CodeSuccessconfusing

After the APK is last generated , use tools such as Apkide to decompile the apk , You can see that the custom variable names and function names have been replaced with meaningless strings.

third, export the signature release versionapk

menu Bar ----Build----Generate signed APK

in the In the key store path, enter the location of the key file that you want to use for signing, and enter the read and write username password for the key file (if you do not have the key file click "Create New" in the diagram)

APK Destination Folder-----apk file generated directory

Build Type---- generate release version or debug version

Signature Version---- which parts are signed

After the build is complete, a release folder under the specified build directory will find the generated apk(app-release.apk Is the version I generated earlier)

Android Studio Package Generation APK Tutorial

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.