I am trying to rename my app package because by mistake I set it as com.example.tanmayagarwalquix , so i want to change that "example" part to "tanbruh" and "tanmayagarwalquix" to "tanmayagarwalquiz" , so i right clicked on "example" and then clicked on refractor then rename but this time its showing some strange warning (unlike it always shows rename package or rename directory options) and when I click on rename all then tried typing tanbruh but android studio get stucked, i had tried many times this same issue occuring, i had tried changing from manifest , and build.gradle also still issue occurs, Has anyone encountered this and is able to help me?
and when i clicked on rename all and change "example" to "tanbruh", then android studio stucked and nothing happened :-
this question is different from suggested question because this is the easiest way to edit package name unlike copy pasting to a new package and this way of changing package name always works but i don't know why this time its not working, please help :)
Related
I am just starting to use Android Studio.
I have followed the steps through in the Studio. I chose "Basic Activity". The app loads, but there's nothing but empty directories there and it has no activity folder or anything to edit the layout with.
I checked it in the Windows explorer, and it just looks the same as in Android studio.
I've read this, this, this, this, this, this, and other ones, and have probably spent over an hour trying to figure out how to do this.
I've also re-tried creating the project at least 5 times, but I've had no success.
Edit: Here's what the app folder looks like:
Edit: Someone told me I should just create a new activity. Being an absolute new person, I didn't know how to do that, so I looked at this post. However, the post tells me that I need to go into the "New" menu, but I don't see "Activity" in here like the post asserted it would be.
In the following menu click the arrow and select "Project" (is better):
Then go to "name of your project folder" > "app" > "src" > "main" > "res".
I have no idea if this was what was causing it, but first I uninstalled then re-installed Android studio, deleted the old project, and created a new one.
It still didn't work, BUT I just noticed a little error log button.
You see, I named my application com.con.pfq. It wasn't liking the "con" part - said it's an invalid file name.
Sooo... I recreated the app as com.connoriscool.pfqmmobile. It liked that more.
No idea what's happening here, but that's the solution.
At first I got an error while exporting my android app in eclipse:
AndroidManifest.xml does not declare a Java package: Build aborted.
I posted this problem in various forums and one guy told me to do these steps:
you need to enter a valid Bundle ID for Google Play. Something similar to "com.company.gamename".
Don't use any special characters.
BUT whenever I try to click on rename application package, the menu disappears and nothing shows up.
Please Help...
From the error "AndroidManifest.xml does not declare a Java package: Build aborted." it looks like your AndroidManifest.xml file has missing "package:com.xxx.xxx" attribute.
You need to confirm on this by double checking AndoridManifest.xml file.
You can try refreshing entire project from project->right-click-menu>refresh. This will fetch latest content from file.
I'm trying to rename my app package name in android studio because when I try to upload to google play it says prefix "com.example" is reserved. So I've been to manifest file - double click in "example" and then refractor this, changed to "myapps" and changed it in the whole project.
Now I try to upload it and I still get the same error message. Anybody knows how to fix this error ?
Many thanks in advance
It seems simple. There are many ways from which one is this:
After you change the name manually in the AndroidManifest.xml, you click on the R.java class and then press F6.
R.java resides in the app/build/generated/source/r/debug/(packagename) directory. It contains resource IDs for the things you use in the android app. Check this question for more information.
Also, Amir is right, try to use a more unique package name. Example: com.(familyname) or your company domain.
For further information, you can visit this question.
I was following a tutorial of Android and
When I was done everything, I got a problem in this code:
getDrawable(R.drawable.ic_launcher);
And I got the message
**"ic_launcher cannot be resolved or is not a field"**
What's more, my icon doesn't appear in tablet emulator,
but starts automatic.
What's going on?
replace "mipmap" with "drawable"
I had the same problem while following a tutorial and i found out that my AndroidManifest.xml file had the following code :-
android:icon="#mipmap/ic_launcher
so I changed R.drawable to R.mipmap it solved the problem . Wherever I found out drawable I replaced it with mipmap. Good to check for mipmap with android studio 1.1.
for more info :-https://androidbycode.wordpress.com/2015/02/14/goodbye-launcher-drawables-hello-mipmaps/
Check top line of your activity if have an import of
import android.R
delete it and clean your app.
Here is how I solved the problem:
In my program there had been android.R import so it was giving error for R.drawable.ic_launcher ....removing android.R import worked for me..!!!
You should check if under the dir gen there's a file called R.java. If so open it and check if there's an attribute called icon.
It could be that you moved your project or copied something from other projects. In any case you can remove the file manually under gen and let Eclipse recreate them. If not, you can go under Projects and then Clean choosing your project. It should work.
OR
I just thought I would add a quick additional answer to this topic. I am very new to Android development and had found that one of my classes was not compiling as it could not find any of my drawable attributes. In the end I tracked the problem down to the fact that the class was importing android.R (automatically added to the imports list by Eclipse). As soon as that line was taken out, the class compiled.
I am building an application and I added a new activity to generate a view. I compiled it. My application can not find anything that is on the format R.id.xxx or R.layout.xxx, I've tried also cleaning my project, closing Eclipse and opening Eclipse again, but nothing. The most strange thing is that before everything was working well. But now it can not recognize even the R.layout.main that is default of my principal activity. Anyone have an idea?
Also I have tried almost everything here: R cannot be resolved - Android error
but no result!
Solved
Thanks to woopsy, also I found the reference to this kind of problem
http://source.android.com/source/using-eclipse.html
it happens because Eclipse sometimes imports R when you press the combination ctrl+shift+O
Remove all your imports for the Activity and then have eclipse fix imports. I have had problems where eclipse wants to import a different R than the one I need.
First of All Check You have R.java File then check
import android.R;
Enter Yourpackages like import com.mypackages.prj;
If you are using eclipse, take a backup of your layout main.xml file and then from the eclipse new file interface create a new "Android XML File" and call it main.xml. copy back from the backup the contents into this new file.
try this.
check your xml files. there might be something wrong in it which is causing R not to build up automatically. To observe such errors, switch your view to Console tab
this is a common error. You need to just search your R.java file in generated section of your project directory in Eclipse. Need to import if the R.java file into the package then import . R;
I hope it will work for you. It was absolutely worked for me...enjoy programming
friends take care that u haven't imported R class, if you have delete "import android.R". The reason is there are two R things one R.java and R.class and we need the java, where we dont need to import rather than referring it. It worked for me and may be to you too.
I found the solution...For me works it
Poject->Properties->Android->Project Build Target (here choose android4.4 or 5.1.1 Android Open Source Project)->Ok
Project->Build All
This function ...
This problem can fix with this process: -
File---->Invalidate cache/restart.
it will restart your android studio and fix that problem