简体   繁体   中英

Renaming and app ID using Android Studio

I have tried several advises from this selfsame side with no luck, yes. The problem I run into is essentially about the .R file during the generating of the APK. Here is an error log quote:

C:\Users\But Dust\Videos\qaoverflow-master\qaoverflow-master\app\src\main\java\org\qaoverflow\q2android\authentication\AuthenticatorActivity.java

Error:(12, 32) error: cannot find symbol class R

C:\Users\But Dust\Videos\qaoverflow-master\qaoverflow-master\app\src\main\java\org\qaoverflow\q2android\interfaces\Q2ARequest.java

Error:(7, 32) error: cannot find symbol class R

C:\Users\But Dust\Videos\qaoverflow-master\qaoverflow-master\app\src\main\java\org\qaoverflow\q2android\Q2AHelpActivity.java

Error:(23, 44) error: package org.qaoverflow.q2android.R does not exist

History of the app.

The app was first developed and distributed on Eclipse by the original author (who is not me) as an open source with its repository posted on Github . It was then taken by another who added a Mathjax using Android Studio and published it as an open source once again with the new app repository on Github in the same manner. The current App ID is: org.qaoverflow.q2android

Myself

I need to rename this source code's app ID (among other modifications) so that I can publish it on Google Play Store. I have tried the following methods

  1. App > build.gradle > sync > Clean project > Generate signed APK
  2. Right click package name > Open Module Settings > App > Flavors > Application ID ... > Ok > Generate Signed APK
  3. Rename it from the AndroidManifest file and then >App> build.gradle > sync > (also tried Cleaning the project) > generate Signed APK
  4. Right click on the package name > Refactor > enter name...

All tried all the above (and others I believe) separately.

I'm assuming that you are using Android Studio:

  • go to the project view (on the left side of the screen)
  • click on the little gear on the top right corner of the project view
  • unselect the point "Compact Empty Middle Packages"

now your packagename "org.qaoverflow.q2android" (in the project view) should be 3 separate packages "org", "qaoverflow" and "q2android"

  • right click on a package you want to rename, select "refactor" and then "rename"

after this is done, go to "build.gradle", find the line that says "applicationId" and rename it according to your new package name

  • select "Build" - "Clean Project"
  • select "Build" - "Make Project"

now it should (hopefully) build, good luck

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM