When i create new project in android? - android

When i create new project in android, i found each and every time error sign on project name just like picture, that could not run? So is that any solution to remove this error?
default.properties file seems like this, which is message from error log.

Have you tried going to Project->Clean... in the menu? This sometimes will help. Also try unchecking Project->Build Automatically and then right click on your project and run as Android.
Edit: You may also have to delete your debug.keystore file. This file should be located in your home directory. Then try clean and build from eclipse and the file should then get recreated.

I used to have a similar proble. Restarting eclipse might resolve it.

Give this a try to fix your properties.
Right-click the project -> Android Tools -> Fix project properties

Related

"AndroidManifest.xml doesn't exist or has incorrect root tag" Error

I am new to AndroidStudio AND Gradle.
I imported a project from eclipse, created a module, and tried to run the project, but I got this error:
AndroidManifest.xml doesn't exist or has incorrect root tag
I have been looking at this previous solution for it:
How to build an android library with Android Studio and gradle?
But that solution is WAY too advanced for me.
Could someone please help me understand in simpler terms what is going wrong and how I can fix it?
Thank you!
Update after one of the answers:
These are the options I have under the build menu:
clicking on Sync project with Gradle files button will solve your problem.
That button is under File section on Android Studio 3.6.1
Close your Android Studio
Goto C:\Users\user\.AndroidStudioX.X\system and DELETE the cache
folder
Launch the Android Studio
Goto Build (menu) -> Clean Project when done click the
Build (menu) again and click rebuild project.
That should solve the problem.
For me the issue went away once I opened the android folder of the project in Android Studio to run the project.
So basically, because I was trying to run the Android project from the Root folder, it gave me the error. We need to run the project by selecting the android folder of the project only.
Hope this helps someone!
Click on File > Invalidate Cache/Restart, and that's it. Your project should start working.
For me clicking on Sync project with Gradle files button did not solve the problem alone.
After Syncing project with Gradle files, I explicitly had to invalidate the cache and restart studio. Only after this action, the red cross-mark over configuration disappeared and everything started working.
In my case, my android project got corrupted and some of the files were showing characters, binary numbers, etc. I tried the following solutions
Invalidate & Restart
Rebuild Project
Sync with Gradle File
But none of the above solutions worked for me.
Then I just deleted the cache folder under C:\Users\username\.AndroidStudio3.6\system
and all the invalid characters disappeared and the actual contents of all the files were displayed. This solution worked for me.
Every Android project needs a file called AndroidManifest.xml to tell Android about itself. Either your project doesn't have one, or it's not in the place that Android Studio expects it to be. Try to find it, and move it to the root folder of the project.
1.Check whether the manifest file is there or not.
2.If it is there, check whether the package name is correct or not..
3.If you project has small number of classes, then you create new project in android and then copy paste your code from eclipse. It will be simple. But it is recommended only for small project.
And finally click 'Sync' in the Gradle file. Followed by Rebuilding the project will do a trick.
In my case the Manifest file seemed to be corrupted or maybe its meta data. Trying to open it in Android Studio will show some characters that you see when opening a binary file with a text editor, for ex. Anyway, my project is under Git, so I just deleted it and restored it back, problem fixed.
Go to C drive click User then select your android studio folder then select System find Cache folder and delete this folder before doing this close your android Studio.It will surely work.
I also had this problem, things I tried:
I delete user->gradle-> delete cache folder
Android studio-> file-> Invalid cache/restart
Using my problem is get resolved
I also had this problem, things I tried:
Syncing the file with gradle
Invalidate/Restart
But the problem was still there in the manifest folder-> manifest.xml file it had only 1 line.
So I went to User-> your_username -> Android Studio v -> caches and Deleted the cache folder.
Started Android Studio, and my problem was gone.
But I am not sure which of these might solve yours.
I have opened AndroidManifest.xml in file editor. Add some letters, save it, then android studio found AndroidManifest.
After this I can build project successfully
if your AndroidManifest.xml looks wierd than you can try checking local history or git history. by doing that you can copy paste the previous version AndroidManifest.xml
Experienced that too, there is a line on your manifest code that's incorrect, simply go through it and make necessary corrections.

Errors when creating a new Android project

Im trying to create an Android project on Eclipse but as soon as i create it, errors appear on the project name.
I dont know whats wrong since I havent written anything myself yet. When when im on the final step of the project creation window (the activity section), I click finish and it takes like 5 seconds and the project name appears on the left, in the project explorer but the window doesnt close.
Heres what it looks like:
Here's the result of the Problems tab:
When you have errors like R cannot be resolved to a variable most of the times you have to solve problems in your Resources, for example you can see the folder \res has a red cross, solve that problems first.
Do the below changes and I guess it should work.
Update ADT & SDK.
Remove gen folder , and create it again .
Do a clean-project.
Right click the project and choose android-tools -> fix-project-properties .
Right click the project and choose properties -> java-build-path -> order-and-export. make sure the order is :
Android private libraries
Android dependencies
Your library project's if needed
yourAppProject/gen
yourAppProject/src
Make sure all files in the res folder's subfolders have names that are ok : only lowercase letters, digits and underscore ("_") .
Always make sure the targetSdk is pointed to the latest API (currently 18) , and set it in the project.properties file
If above doesn't work then try next method 2 given below:
The step to solve the issues is easy. You just mouse point to your project folder (Example: SampleAndroid), then right click and now choose “Build Project”. Your all project will rebuild.
Once rebuild complete, you can see that the error icon was disappear on the MainActivity.java code. Now you can run your application in Emulator.
Maybe try "Project->clean" in order to rebuild.
First of all check the Problems tab that will you show you what may cause this. Also clean your project as it might solve some issues.
I also faced the same problem and solved it by deleting appcompatv4 file from libs folder. Try it, it might help to you.
I have this problem, finally,I solved this by opening my SDK manager → download Android support in Extras,you can try.
check your Android support is installed, and then you can build a new project without errors.

R.java disappeared

I recently downloaded the Android Support Package and have been using it trying to get my application, running at SDK 10, to use a GridLayout.
Anyway, I cleaned my project a few times working on this error in my XML files, and then when I went back to my classes in /src, every single reference to R.* was an error.
This has happened to me before, but it usually fixes itself, and it has not yet. Does anyone know what to do?
The R.java file is no longer in my /gen folder.
It sometimes happens when you import another project First i suggest you to build it, it will create automatically .
If it's not working then try to create new project from existing source and specify the downloaded project . It worked for me
Hope this works for you let me know..
Sometimes if there is an error in your XML files R.java won't build. Go through your XML files to make sure that everything is in order (typo, forgetting to close a bracket, etc). When you fix that it should build itself again.
You can also try Adnroid Tools>Fix Project. That may help you to create gen/R.java file
Follow following steps :
In Eclipse,
=> Right Click on Project > Android Tools > Fix Project
By this way, you can fix many common problems which can help generate R.java in gen/R.java file.
There can be several reasons why this occurs. The following I have found happen to me and I have included the steps I took to resolve them.
First step is to try and clean the project (from the Project menu option I believe)
Check there are no errors with your XML files. Sometimes this is obvious from the red 'x' that appears next to an XML filename in the Project exlporer window and sometimes it is not. If it is not obvious check the 'Errors' window (whic is founf in the 'Windows' Menu option
Failing that I have found that by disabling the automatic build option, adding some arbitrary comment to an arbitrary source file, saving the source file, clean the project, remove the comment and then re-selcting automatic build can work too.
Apologies for the approximate locations for some of the Eclipse functions but I am not currently in front of Eclipse to check.
This happens when you have an error in the res folder.
Fix the error first, then do :
Project --> Clean --> Ok
Et voila !

simple Android Project error

At first, my Android project well ok.
I was away from my Android Project for a month.
Now, whenever simple Android projects are error, eventhough Hello World prj with Android.
There is no error in my simple but at he name of project Folder , there is red cross for error sign.
I was updated Installed Android parckage.
However, it is not ok.
Is there anyone who know how is it?
Which IDE are you using. IF Eclipse go to project in the task bar and clean your project.
Also check problems window.
if above solution can't help you . create a new project and copy src , res and manifest into it .
I found the Problem explore
Error generating final archive:Debug certificate expired on 8/5/11 2:35 PM!
So, delete debug.keystore file at window machine %USERHOME%/debug.keystore
clean the project.
All are fine!
There are might be two solutions
Clean project
Simply copy past your code into new android project
Clean and rebuild should resolve the problem.

R.java deleted automatically: Android

When I changed some design in .xml file, R.java file automatically deleted. How can I get back that file and what is the solution to resolve this problem, that in future this problem does not occure.
check all your errors in xml files structure (layouts, string etc...) even if sometimes they are not easy to spot.
My advice is to undo the latest things you've done until you find where the errors were and fix them.
Once they are all fixed the R file will be created again (maybe you need to clean your project: project -> clean)
In the future just try not to break the xml files and this won't occur again xD
You can also disable automatic build in your Eclipse IDE(Menu -> project- > Uncheck build automatically). This way the R file will be recreated only when you manually build the project and not when you save changes in an xml file.
Fix your errors and the R.java file will return...e.g when i added an image in my resources folder its name was in uppercase....when i changed it to lowercase,immediately after doing it my R.java file returned...its all due to errors...just fix them and it will return
I agree with #maid450.
I also have faced similar situations.
If your problem isn't resolved after all this, ultimate option is to create a new project, and copy files to it.
one solution is that Go to Eclipse project tab -> uncheck Build Automatically -> Clean the project.Make sure that there is no error in your project also don't try to edit the R.java file one it will created. Then manually build the project. you will get the r.java file.
The best solution for Mac/Eclipse user is to go to the SDK Manager and re-install the Android SDK Build-tools, and then restart Eclipse.
For some reason after performing a Clean action on a project the R.java file for all projects happens to be deleted from the system.
Clean the project.
Menu [Project] -> [Clean...] -> Select you project -> [OK]
Project will rebuild automatically, if not, chek
Menu [Project] ->[Build Automatically]
The R file deleted automatically when I changed my activity_main.xml in Android Studio.
What I did was copy the R java file from another project and paste it into the project in which it got deleted.
Hope it helps. :).
Location for R file.
Project/app/build/generated/source/r/debug/com.android.'projectname'/R.java
Where is the R.java file in Android Studio?

Categories

Resources