Android Studio - Android Project View is Missing - android

I've found some webpage but it does not guide me back to normal android project view.
http://developer.android.com/sdk/installing/studio-androidview.html
I did File => Other Settings => Default Project Structure => Default Settings => OK It make even worse, import library become not function-able.

I also had this problem (creating new project also looked similar to IntelliJ IDEA), got it fixed when I enabled some Android-related plugins.
Go to Preferences (Settings on Windows and Linux) > Plugins and enable Android Support, at a minimum.
Now you will have "Android" option in the Project View.

Try:
View -> Tool Windows -> Project OR the shortcut is alt+1.
If that's not working try:
Window -> Restore Default Layout OR the shortcut is shift+F12.
Also, check that Studio is up to date:
Help -> Check for update...

None of the above solutions worked for me so I fixed this by removing the .gradle and .idea folders from my project.

The square at the bottom left corner of android studio lets you spread the screen or it populates it with side menus.

For me, it happened when I used Kotlin KTS for Gradle files, but created a java library module for this project. After trying to reimport project I got an error:
New Gradle Sync is not supported due to containing buildSrc module
Solution:
Migrate added module to kts
Remove created by Wizard settings.gradle, if you already use settings.gradle.kts
Reimport project
File -> Close project
Android Studio: import project
Show it your current project location

Just had the problem happen to me again. I got the problem solved, but unfortunately I can't confirm the solution, now that it's fix; but I have strong suspicions on what was the cause.
In my case, the problem occurred as a result of reorganizing my project directory. My projects are stored in given directory lets call it "Projects". I renamed that fold to "ProjectsBackup" and created a new "Projects" directory. I then moved selected projects now contained in the "ProjectBackup" directory to the new "Projects" directory. After moving the first project, I used Android Studio to open that project. That's when the problem occurred. I got a message that it couldn't find the gradle-wrapper and offered me the choice to create it. The gradle-wrapper is stored in a directory call "gradle" and its stored in the "Projects" directory. I had not copied that directory over from the "ProjectsBackup" to the new "Projects" directory. At the time, I thought nothing about that since, a new one was created. After trying all the various suggestion in this problem discussion, android studio offered a notification from me to update my "android gradle" plugin. I did the update and after that the "android" view was now available for me to select. The android gradle update fixed the problem.
I unfortunately, can't tell you what changed as a result of the update, nor can I tell you how you can force Android Studio to update or reinstall the android gradle plugin. All I can tell you is that I got lucky that android studio gave me that notification to update the android gradle plugin. Things like "file/project structure" and changing the Android Gradle Plugin Version, didn't fix the problem. What I did notice, was that when I first looked at that, the drop-down list of android gradle versions was an empty list. I manually put one in "3.6.3", but it didn't help. If you run into this problems I would suggest you look at the dates of the two file in the "wrapper" directory and compare those to projects you may have that are working correctly with the android view. I wish I would have checked the date of the wrapper jar file, when it wasn't working. That's what I think might have been wrong (i.e. I got a wrapper.jar file that was incompatible with my version of android studio - unfortunately I can't prove that)

problem solve i have click this button

Related

Why does Android Studio don't "accept" "getBoolean"? [duplicate]

I'm importing twitter4j in AndroidStudio, using the following in my build.gradle:
dependencies {
compile 'com.android.support:support-v4:18.0.+'
compile files('libs/twitter4j-core-3.0.4.jar')
}
The project compiles fine, and I can create twitter objects without a problem. However, in Android studio, anything referencing that library shows "cannot resolve symbol" and displays in red. What do I need to do to get Android Studio to recognize the library?
I have already tried rebuilding the project, ./gradlew clean, and closing and re-opening my project.
No idea if this will work or not but my only thought so far: right click the jar file in file tree within AS and select "Add as library..."
EDIT: You can do "File" -> "Invalidate Caches...", and select "Invalidate and Restart" option to fix this.
EDIT 2: This fix should work for all similar incidents and is not a twitter4j specific resolution.
Try changing the order of dependencies in File > Project Structure > (select your project) > Dependencies.
Invalidate Caches didn't work for me, but moving my build from the bottom of the list to the top did.
This is what worked for me.
In the Project panel, right click on the project name, and
select Open Module Settings from the popup menu.
then change the Compile SDK Version to the minimum version available (the minimum sdk version you set in the project).
wait for android studio to load everything.
It will give you some errors, ignore those.
Now go to your java file and android studio will suggest you import
import android.support.v4.app.FragmentActivity;
Import it, then go back to Open Module Settings and change the compile sdk version back to what it was before.
Wait for things to load and voila.
For mine was caused by the imported library project, type something in build.gradle and delete it again and press sync now, the error gone.
I also had this issue with my Android app depending on some of my own Android libraries (using Android Studio 3.0 and 3.1.1).
Whenever I updated a lib and go back to the app, triggering a Gradle Sync, Android Studio was not able to detect the code changes I made to the lib. Compilation worked fine, but Android Studio showed red error lines on some code using the lib.
After investigating, I found that it's because gradle keeps pointing to an old compiled version of my libs.
If you go to yourProject/.idea/libraries/ you'll see a list of xml files that contains the link to the compiled version of your libs. These files starts with Gradle__artifacts_*.xml (where * is the name of your libs).
So in order for Android Studio to take the latest version of your libs, you need to delete these Gradle__artifacts_*.xml files, and Android Studio will regenerate them, pointing to the latest compiled version of your libs.
If you don't want to do that manually every time you click on "Gradle sync" (who would want to do that...), you can add this small gradle task in the build.gradle file of your app.
task deleteArtifacts {
doFirst {
File librariesFolderPath = file(getProjectDir().absolutePath + "/../.idea/libraries/")
File[] files = librariesFolderPath.listFiles({ File file -> file.name.startsWith("Gradle__artifacts_") } as FileFilter)
for (int i = 0; i < files.length; i++) {
files[i].delete()
}
}
}
And in order for your app to always execute this task before doing a gradle sync, you just need to go to the Gradle window, then find the "deleteArtifacts" task under yourApp/Tasks/other/, right click on it and select "Execute Before Sync" (see below).
Now, every time you do a Gradle sync, Android Studio will be forced to use the latest version of your libs.
When i lived to this problem(red color codes but they work correctly) in my project;
As first, i made it that (File -> Indicate Cashes) --> (Invalidate and Restart).
As last, i resync my build.gradle file in my app. After problem was resolved.
Invalidate Caches / Restart didn't work for me this time.
Found a solution like this:
Remove the compile *** or implementation *** line in build.gradle.
Clean and rebuild. Errors should be raised here.
Add the line in step 1 back to build.gradle.
Clean and rebuild.
Weird...
This problem happened for me when my Glass project was not using the SDK installed in Android Studio's default location. I was using another location I had previously from ADT, since I was trying to avoid re-downloading everything. Once I pointed the project back to the SDK location in Android Studio's install location the problem went away.
I had this problem for a couple of days now and finally figured it out!
All other solutions didn't work for me btw.
Solution: I had special characters in my project path!
Just make sure to have none of those and you should be fine or at least one of the other solutions should work for you.
Hope this helps someone!
I had the very same problem recently with Android Studio 1.3. The only working solution was to remove the .gradle and .idea folders and re-import the project into Android Studio.
For those, who tried the accepted answer and have no success,
I tried also the accepted answer and did not work for me. After that, I updated my project with the repository and synchronized the project and the could not resolve warnings are gone.
Invalidate Caches didn't work for me (this time). For me it was enough changing the gradle and syncing again. Or https://stackoverflow.com/a/29565362/2000162
If nothing else helped, you could do as Android Studio suddenly cannot resolve symbols recommends:
Exit Android Studio
Back up your project
Delete all the .iml files and the .idea folder
Relaunch Android Studio and reimport your project
In my case, I had created a new file using the GUI and defined an interface within the file. I kept getting this symbol error because the file was not a "java" file. It had no extension on it at all.
After modifying the file extension to ".java", the system correctly finds the symbols.
In my case the jar file did not have a META-INF/MANIFEST.MF file. After adding one, it worked!
For my case working with AndroidStudio 2.2.3 the solution was to change the gradle wrapper/distribution to use local one in the Gradle Settings (despite of being "recommended").
This worked for me--
(File -> Indicate Cashes) --> (Invalidate and Restart).
I tried Invalidate cache/restart or clean Project -> rebuild project. These didn't work for me.
The final solution was open Project window on the left side of IDE, under Project mode, delete .gradle and .idea folder, THEN you can invalidate caches and restart. This fixed it.
Change compile to implementation in the build.gradle.
Changing the language injection settings worked for me.
Place the cursor on any of the red underlined code and Alt + Enter
Now select Language Injection Settings and a window will open as shown below.
Uncheck the selected option and click Ok
Hope this helps somebody.
It happened to me when I removed the whole files in .gradle/caches, then studio downloaded the dependences. The dependences not showed in the External Libraries but I can build App successfully. rebuild clean Invalidate and Restart have no effect. I solved the problem by the steps:
Close Android Studio completely
Remove .idea package in your project
Restart Android Studio
I have tried this but nothing worked for me:
Invalidate Caches / Restart
Changing the order of dependencies
Sync project with Gradle Files
Clean -> Rebuild Project
In my case, just do:
Delete all files in .idea/libraries folder
Rebuild Project
For me I updated gradle-wrapper.properties into 4.4
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
I found easiest way
Identify the library which is causing syntax error in Studio.
For Example if AppCompatActivity is showing error then you will perform below operation on AppCompat Dependency.
Remove dependency which is showing syntax error & Sync.
Add again & Sync.
That's It, error gone!
Before
After
None of the answers above works for me.
After a lots of attempts, I upgraded com.android.tools.build:gradle in Project/build.gradle from 2.3.0 to 3.0.1, and it works.
I guess the version of the com.android.tools.build:gradle should be match to the version of AndroidStudio, and my AS version is 3.2.1
I tried all of the posted solutions and none of them worked for me. (Though invalidate caches does normally. This time it made no difference). After trying everything posted here the "Error cannot resolve" were still present. And the project did build and run successfully, only the IDE seemed to be confused, not the actual app or device.
My Version of Android Studio is 2021.3.1:
The solution that did finally work for me was updating the "Android Gradle Plugin Version" configuration inside of File -> Project Structure.
It was originally 3.2.1 when it wasn't working. I updated it to 3.5.3 because I have another project that was working fine and it was on that setting.
After making this change and then sync'ing gradle the symbols not resolved error goes away and the IDE once again knows what those classes are.
Closing all files and closing Android Studio works for me.
You need to restart Android Studio.

Android studio alway show "Gradle project sync in progress"

After update android studio Build number AI-141.1809159 version=1.2 in Canary update, i can't sync gradle project and always show "Gradle project sync in progress"
Following are the steps that I use (Kind a workaround),
Edit the root build.gradle file (adding a new line to file will also
do).
Save the file.
Restart the IDE (File->Invalid Cache/Restart->Just Restart).
Gradle Sync in progress notification should go away.
I found this was due to this plugin being used in AS:
'Android Studio Unit Test'
To disable this in AS 1.2 do the following:
File > Settings > Plugins > Android Studio Unit Test disable
Problem is solved, just update android sdk, it's work for me.
This happened to me twice and had to do with one of the gradle files having a date in the future (a glitch in Android Studio it seems). That is why just adding a space to the file and saving can fix the problem, as described above. Or go through your project with the operating system file explorer to find the file.
wait for some time, if you are using somebody else repo. It depends on the projects buildings. You might see new changes like file path, project-level dir appearing, etc.
Disable VPN if you have it active.

Error: Android source build in eclipse

While trying to add android source to eclipse, I am getting the following errors.
Project 'android' is missing required library: 'out/target/common/obj/JAVA_LIBRARIES/gsf-client_intermediates/javalib.jar'
Project 'android' is missing required library: 'out/target/common/obj/JAVA_LIBRARIES/google-common_intermediates/javalib.jar'
FYI, I have built the source successfully with full_maguro-userdebug configuration (for Galaxy Nexus) before adding this to eclipse. Since I couldn't find "create project from existing source" in Eclipse Indigo, I changed the location of the project to the root directory of the source. I refreshed the project several times with same error.
How to solve this issue?
You should go to Project -> Properties -> Java Build Path.
There open tab Libraries.
In this tab out/target/common/obj/JAVA_LIBRARIES/google-common_intermediates/javalib.jar should be changed to out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar by selecting javalib.jar from google-common_intermediates, pressing Edit and selecting instead android-common_intermediates.
Entry with gsf-client_intermediates javalib.jar can be simply deleted.
A more comprehensive answer at here: https://groups.google.com/forum/?fromgroups=#!topic/android-platform/XIbR8ZKe7Tw
I would not recommend using eclipse for android source. Android is not a single project and it too big for an IDE like eclipse to handle.
Use simpler plain text editors like vim, emacs to browse the code

Cannot build library dependent project after update to ADT 14

In order to implement different versions of our UI we broke our program up into UI specific code and a common library project that has everything else. Up until yesterday when I updated to ADT 14 everything was working fine. Now I can't build. I keep getting the error "The container 'Library Projects' references non existing library 'path to the bin folder of my common project and the name of the project.jar'
I've been all over the web and tried everything I can think of to fix this to no avail. Can someone help me out? I'm basically stuck at this point.
Maybe you have the same issues I had when switching to the new ADT:
In my previous setup I had some resources split between the library and the main project. The library project would not compile error free on its own but only in combination with the main project which added the missing resources.
It doesn't work like this any more.
The library project must compile completely error free now. When it does the build process will create a <lib_project_name>.jar in the bin folder of the library project.
If the jar file is not created ( thus the build process of the library project failed for some reason - eg. because the changes in the R.java file (see http://tools.android.com/recent/buildchangesinrevision14 )) you will get the error message you described.
Also, I had to manually remove the <lib_project>_src from the project.
I've had a problem with a few different projects where I did the fixes suggested in the other answer, but they were only fixed temporarily.
Every time I reopened Eclipse or did a Clean on a project, the "Library Projects" directory would disappear, and I would have to open the project properties, remove the library, and add it again.
I solved this the hard way by creating a new project and copying everything into it.
Then I found an easy way to solve it. Right click the project, Refactor-->Rename. You can rename it back afterwards. This fixed it.
Check out the article "Changes to Library Projects in Android SDK Tools, r14" ( http://android-developers.blogspot.com/2011/10/changes-to-library-projects-in-android.html ) on the Android Developers blog.
E.g. #P.Melch: "I had to manually remove the _src from the project" should be done as follows:
To fix the project, you must remove the extraneous source folders with the following steps:
Right click source folder and choose Build Path > Remove from Build
path.
A dialog will pop up. In it, make sure to check “Also unlink the folder from the project” to completely remove the folder.
You have to update the Android SDK in Android SDK Manager
Android SDK Tools Intalled
Android SDK Plataforms Installed
Android SDK Builds Installed

Missing AndroidManifest.xml when importing an old Android project into Eclipse

I have an Android project developed on Eclipse (GNU/Linux) that I last touched half a year ago. I am trying to import the project into Eclipse 3.6 on Windows (with ADT installed) installed using File -> Import Project in Eclipse. When the project is imported, I see the following error twice on the console:
[2010-12-10 02:17:12 -
com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper]
Unable to read C:\Program
Files\Android\android-sdk-windows\AndroidManifest.xml:
java.io.FileNotFoundException:
C:\Program
Files\Android\android-sdk-windows\AndroidManifest.xml
(The system cannot find the file
specified)
Why is Eclipse looking for AndroidManifest.xml on the Android SDK path? The file actually seems to be in the project's directory. How do I fix this problem and get the project to compile?
A simple solution is to either reimport the AndroidManifest.xml file or make a change to the file and save it. This worked for me.
If you see an error about AndroidManifest.xml, or some problems
related to an Android zip file, right click on the project and select
Android Tools > Fix Project Properties. (The project is looking in the
wrong location for the library file, this will fix it for you.)
from: http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html
The way you are importing the Android project into Eclipse is wrong. The Correct way of doing is File -> New Android Project. In the Contents Tab in "New Android Project", select "Create project from existing source" and choose the Build Target. That should fix your problem.
It appears that this error is produced because Eclipse thinks the default location for new Android projects is the Android SDK path. Even if the project location is changed, the error fails to be resolved, so the trick is to change the project location before Eclipse is aware of the condition generating the error.
To circumvent this quirk I imported the old project with the following steps:
File -> New -> Android Project
Un-check 'Use default location' and browse to project root directory.
Click 'Create project from existing source'
It's important to do step (2) before (3) otherwise the error persists and prevents running the project.
I had the same problem, all of the above did not work. I cleaned the project and it worked.
Instead of using File ---> New Android Project --> "Create project from existing sources", which will result in the error your are seeing, choose "Create project from existing sample" and choose it from the drop down. This will work.
Experienced JAVA developers tend to go with the first option which is normally there and works for classic Eclipse projects. But this is not your typical project and I bet the Google developers put this special case in the wizard to accommodate the differences.
I had the same problem. I was trying to compile the JakeWharton view page sample, so I checked out the GIT in a directory in a different folder then the workspace which caused the problem.
Eclipse was maintaining 2 folders:
1. A new workspace folder was made under the workspace directory, which eclipse checks for libraries and others source code including the AndroidManifest.xml file
2. The existing folder which was not under the Root workspace
To fix the problem after importing I had to manually move the files in the new workspace folder created by eclipse.
I met this problem when using Facebook SDK, now I solve it by doing this:
Close the project;
Copy "AndroidManifest.xml" file to the project's root path;
Open the project and refresh it, it's Done!
this worked for me by the way:
I changed the project name to the exact name of the project that I am importing.
Eclipse seems somewhat fragile in its naming conventions. One of the causes for this error is a difference between the project name and the folder name in the workspace. I imported a zip file for a project named "HelloDialogs" into a workspace folder named "HelloDialog". This caused the "AndroidManifest.xml file missing" error. Once I renamed the folder correctly, everything worked fine.
Because of the multiple different answers here, I thouhgt I'd add yet another one that worked for me, as I had exactly the same issue when first working with Phonegap android dev tools.
So I found (as mentioned by Gintautas in comments to the accepted answer), that I had to create a new project using the phonegap 'create' script, then when importing the project into eclipse. the only way to get this to work successfully was if the project was originally created in some temp folder somewhere other than the place I actually want to work with it.
So I created a project in windows like this in a cmd window...
c:\phonegap\phonegap-2.6.0\lib\android\bin>create.bat c:\temp\android_boilerplates\test app.test test
Then I imported the project in eclipse like this...
File > New > Project
Within the new project wizard select: "Android Project from Existing Code"
Click "Next"
Now navigate to the temp location of your project and set that to the root directory, check the project you want and check "Copy projects into workspace" as the example below...
Click "Finish"
And that's it, Eclipse should copy all your project files into your workspace and there shouldn't be any errors in your project (fingers crossed).
Your project should look something like this...
Hope that helps, it took me an age to work out why Eclipse didn't like creating a new project from existing code when the new project was being setup in the same place as the existing code. This isn't a problem for other languages I've used, so it was a little weird, but understandable as Eclipse (I'm guessing) seems to want to overwrite certain files.
Eclipse randomly decided to make another folder instead of the one that i had specified, but doesnt have any resources or data or layout etc in it..
it has some conflicts i guess..
anyway, a noob approach to this was, copying the original file to some other location(i put it to desktop)..
now create new project-create existing project, select this one from desktop, n VOILA.. its all fine.. :D
I am a little late to this game but I caused this same problem by generating the initial application into the exact location I was going to work on it. That is to say I put it directly into my current workspace. I then did File, Import, Existing Android Code Into Workspace. The import process blanked out my android.xml file.
I tried above solutions and had no joy. I then generated the initial application into a temp directory and imported from there. This worked for me.
The only way to import a project into eclipse workspace is to create an empty project and then drag and drop all the folders and files into this project. Why is this so is beyond me.
The answer from Raunak is wrong.
I found a .classpath file in the root directory of my Android project. I opened it and updated the file paths in it, and it seemed to fix the problem for me.
I had the problem when I tried to update an old project with recent code from the SVN. I had the Manifest.xml exported to my local file system as backup and deleted it. I've then reverted my complete project to the most recent version from the SVN and then it worked :)
This is what I had to do to get this to work. Fortunately I had backups of earlier "project".
1) Import the project as usual.
2) If the errors with empty xml etc. comes up, close the project.
3) Go to the original project if you have backup.
4) Copy all of the projects root files and directories and paste it over where Eclipse expects the projects root directories and files to be.
5) Open the project and refresh. Make "Clean" if necessary and you're done!
Always make backups because Eclipse f--kups! I learned this the hard way when suddenly my Android project refused to work because of empty manifest-file.
Sometimes if you automatically fix imports in MainActivity IDE imports android.R class instead of one that will be generated for the project. Remove the import and recompile.
when importing project from another workspace add existing project in workspace. and tick to the copy projects in workspace.then check the api level and supporting library from project.properties files.then rebuilt project and clean it.. it is works for me.
2017 Solution: Much Easier and tested solution is to remove your application folder from elipse project only then Import it again and the problem will be fixed immediately!

Categories

Resources