React-native Modifying the Android package name

Source: Internet
Author: User
Tags unique id

Android has a package name as the app's unique ID, which is not as easy to change as it is for iOS, but it has to be changed in order to be able to officially release its app.

Assuming the package name is com.exease.etd.objective , the following needs to be modified.

    • The first is two Java files: Android/app/src/main/java/com/project_name/mainactivity.java and/mainapplication.java, modifying the first behaviorpackage com.exease.etd.objective;
    • Then the description file for Android Android/app/src/main/androidmanifest.xml, the second line to change the package tocom.exease.etd.objective
    • Then there are two packaged scripts.
      • Android/app/buck, modify the value of the two packagepackage = ‘com.exease.etd.objective‘,
      • Android/app/build.gradle one of the ApplicationID, insteadapplicationId "com.exease.etd.objective"

After the modification is complete, the command line enters the Android directory and performs ./gradlew clean a clear cache (Gradlew.bat on Windows)

At this point it's almost done, and the APK with the correct package name can be packaged. However, in the development process, if the need for automatic link native module, will cause the command error cannot link success. It is recommended that Java files be placed in a directory matching the package name according to Java specifications.
Move the Android/app/src/main/java/com/project_name/mainactivity.java and/mainapplication.java two files into the newly created directory ANDROID/APP/SRC /main/java/com/exease/etd/objective/inside, you can happily react-native link.

Transferred from: http://www.jianshu.com/p/8b7412bab029

React-native Modifying the Android package name

Related Article

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.