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.
Related
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.
So I've been searching around for days trying to figure out why I can't implement admob into my Android Studio project.
Things I've tried:
I have the google play services installed and latest Android SDKs
File->Project Structure->ads->ticking admob
--this will try to load in the dependencies, and always fails with
(Error:Could not find method dependencies() for arguments [build_23ysmkvnpvbphbg3g4deijgq4$_run_closure6#4afc19b] on org.gradle.plugins.ide.idea.model.IdeaModel_Decorated#18b40be.)
I've tried deleting the .gradle folder, restarting AS and rebuilding with the same Error.
I've tried creating a new blank LibGDX project and importing that and directly getting the admob dependencies and still the same error message.
I'm honestly not sure what I'm overlooking here.
If there's any info you feel I've left out, please let me know.
So, I'm coming from the Eclipse environment, and whenever I built a libgdx project, I've never had to go into the "advanced" settings. so messing around some more I went into the advanced settings and saw a checkbox for IDEA(generates intellij IDEA project files) which has seemed to work in getting rid of that 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.
I am currently working on an Android project, which references some Android libraries.
After importing the libraries as projects in my Workspace, I add them to my project:
Project > Properties > Android > Library > Add..., and I add the needed Libraries. Everything seems ok, as shown here.
However, as soon as I click on the OK button, The appcompat library doesn't seem to be recognized anymore (Build errors still displayed on appcompat's classes, resources missing, etc).
Indeed, the Project > Properties > Android > Library Menu now displays this, showing an error only on the appcompat library.
Am I missing/not understanding something that may explain this behaviour?
Moreover, how can I fix this problem?
[UPDATE] Using Project > Clean, followed by File > Restart, solved the problem.
As I can now close the Android window and reopen it without the library integration failing as before, the problem seems to be definitively solved.
However, I am still clueless: what could have been the cause of this problem?
I had once one big problem related to partitions in my PC. Please, be sure that you have your source code and your libraries in the same partition. It's very important, and I hadn't read before I had the problem.
Copy appCompat library in the same folder where FacebookSDk and
GooglePlayService is there.
Import the appCompat project into your eclipse.
Add as library to you're project. You're problem will solve.
I was able to import both ActionBarSherlock and HoloEverywhere into Android Studio but I cannot get my app to compile.
screenshot:
https://docs.google.com/file/d/0BwOn70drOiMfZHZVeXdEVzNXRXc/edit?usp=sharing
For whatever reason my intent's seem to be freaking out and even though the library imports seem to be working fine, I'm also getting the following errors trying to emulate my application:
java: /Users/patdugan/usmc-pro-fitness-abs-he/src/com/patdugan/usmcprofitness/USMCProFitMainActivity.java:16: package org.holoeverywhere.widget does not exist
Anybody have any thoughts?
I just had this issue.
What you need to do is go to File > Project Structure... and click on Modules. Make sure that ActionBarSherlock has the support library under its Dependencies tab. If not, click the plus at the bottom and add a Library (You may have to click New Library... to select the libs folder within the sub-project).
After this is done, change the scope to Provided so that you don't get lib conflicts when compiling your app.
Holoeverywhere doesn't use ActionBarSherlock anymore, it now relies on the ActionBarCompat library.