android studio view not displayed in designmode - java

I have an androidstudio-project which has not been worked on for some time. When i opened the project, androidstudio did a bunch of updates. Now all the views are not displayed in the design-mode:
I have created a new view and i get the same problem. I have tried to clean / rebuild the project. I also tried to invalidate the caches, but the problem is still there.
I have no error in my project, i can launch the application.
Can someone explain me why this happened and how to fix this?

Did you try creating a simple layout? Probably a relative layout with a TextView or so?
Try changing the Api version to a lower one. Check your Manifest for the theme you have set, try changing that also. Also check if your gradle version is the latest and the you are using the latest API version for building your app.

Related

Android java class/symbol not found despite being placed in the same directory

I have encountered issues in my android studio regarding java classes/symbols not found, despite these classes and symbols being placed in the same directory, or under the same parent directory. I am making use of the DJI's mobile SDK for android.
Example of errors:
Cannot resolve symbol 'DJISampleApplication'
For illustration, here are 2 screenshots
First example. Clicking on "import class" causes android studio to create a brand new class instead of linking it to the existing one.
second example
However, oddly, when I go under "Build >> Make Project" , or "Run" to deploy on a real android device, the app can be installed, and there are no errors (only warnings).
Things I have tried:
Uninstalling and re-installing android studio
copying the whole project from the original files in again
Trying on another computer, which works. However, as i am only assigned this pc, i have to get this to work here as well.
Thank you in advance !
Your best bet is to invalidate caches and restart. Solves 99% of problems like this for me.
You can also try to reimport the project using the gradle tool window ...
Click the reload button here ...

Android - Eclipse project making and R file error

I'm having issue with Eclipse and I work in android. This issue happens when I create a new project and when I click finish, It auto generates the project without R file and The project creating window doesn't closes and I have to close it. I have many old projects which work fine(Until now) and the issue is only coming when I make a new project. I also get a error in Styles.xml file saying that "Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'". When I press CTRL+RightClick onto R file then it takes me to a window which says "Source Not Found". If you have any solution for this, Please post your answer under this question. Thank you!
EDIT: Appcompat error was solved later.
To solve missing R in generated java files, make sure that Android SDK Tools and Android SDK Build-tools are installed and updated in SDK Manager. Then, make sure Eclipse is updated. After this, clean your project and rebuild.
To solve No resource found "...AppCompat...", make sure Android Support Library is installed and updated in SDK Manager. Then, the AppCompat library can be found at:
android-sdk/extras/android/support/v7/appcompat
You need to reference this AppCompat library in your Android project.
Import the library into Eclipse. To do so:
Right click on your Android project. Select properties. Click 'add...' at the bottom to add a library. Select the support library. Finally, Clean and rebuild your project.

Gradle automatically include Appcompat V7 in Android Studio

I have just started to use Android Studio, migrating from Eclipse. I encountered a problem right on the start: I want to create an application project for android 3.0 and up. However Gradle automatically include Appcompat_v7 in their dependencies, and the default java code extends ActionBarActivity instead of Activity. I tried to things by delete the dependencies but everything just went berserk, so I am here to ask you guys what is a possible fix for this. Thank you very much.
Edit: I thought you were using eclipse. But let my answer stay here so that someone using eclipse may see the solution.
When creating the project please make sure you unchceck the "Create Activity" checkbox. This way you can prevent Appcompat_v7 to be added automatically.

Eclipse-AndroidEmulator doesn't apply changes of the project

I am currently developing an Android app with Eclipse Indigo (including Android plugin).
Everything was fine in the beginning. Then I made some changes and saw that the debugging perspective doesn't apply any of the changes. It always loads the same outdated version.
Restarting debug-perspective doesn't help.
Cleaning the project doesn't help.
Relocating the workspace or restarting Eclipse or the computer doesn't work either.
I once could load the whole new project by completly deleting everything (including Eclipse, Android plugin etc.) and reinstalling. But this is not an option for every time I wanna try out a new method.
Funny thing: if I write some text in the EditText-fields the text will still be there when I restart the debugging.
Any ideas how I can fix this problem to get the actual project?
Solution: Create a device with snapshot deactivated.
It was on auto-activate in my version of android sdk.

Issue in accessing R. resources in Android 2.2

I am very new to Android application development.
I successfully added some backgrounds to several layouts. And added media files to play. However when I rename a file in the folder structure, it shows an error that the resource does not exist.
But I can see those files in gen-><mypackage>->R.java->drawable.
Now my background pictures and resources do not appear in code.
R.layout.splashforproduct1 it shows an error for splashforproduct1.
not only splashforproduct1 but this issue is the same for R.raw.media.mp4
This is not first time I have got this issues. Please help me.
I am using Android 2.2 with eclipse.
If cleaning your project doesn't work try this: Scroll up to the top of the file and delete the import lines. Then wait for Eclipse to detect your changes and let it work out what you need to import and accept its suggestions.
I guess you just need to clean your project.
In Eclipse you do it clicking:
Project -> Clean and then you choose your android project.

Categories