Android - Eclipse project making and R file error - java

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.

Related

Error in Eclipse Juno

Goodafternoon community! total beginner here. I am developing my first android app and have downloaded all what is required in running Eclipse Juno as well as files from SDK manager. But when I'm creating a new Android Application Project I encounter a couple of errors already.
It says,
Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
(^in red)
AND...
WARNING: unable to write jarlist cache file C:\Users\Nokia\thesis2\appcompat_v7\bin\jarlist.cache
(^ in black)
Can anyone help me. Thank you very much everyone! :-D more power to you guys!
You should add support v7 library in your project. If you are not installed it using SDK manager,
Android developer site will help you.
After that the AppCompat Can be found at
android-sdk/extras/android/support/v7/appcompat
You need to reference this AppCompat in your android project.
Import the library to eclipse.
Right click on your android project.
Goto Properties.
Select Android.
Click Add Library and reference the same.
Clean and Rebuild your project

Android appcompat v7 error

Being new to Android developent I followed the simplest of tutorials, built a new android project, accepting all default settings (built it for kitkat). To my dismay I have an un-planned project - appcompat_v7, along with the errors:
The container 'Android Dependencies' references non existing library
'C:\Users...\workspace\appcompat_v7\bin\appcompat_v7.jar'
and twice the following
The project cannot be built until build path errors are resolved
Is there a quick way to fix these?
Is this a sign of how difficult, and bugged with unpleasant surprises learning Android is going to be?
(Hope it will not be similar to learning IOS 6 years ago...)
The appcompat_v7 library is added by default to an Android project. You will most likely need it for any demo projects you start making.
To correctly add this library, follow these steps:
For Android Studio:
1. Ensure that you have the Android Support Repository installed in your SDK Manager:
2. In your build.gradle file, include the following implementation statement
implementation 'com.android.support:appcompat-v7:+'
within the dependency bracket.
3. Perform a Gradle sync with the Sync Project button.
~LEGACY ANSWER~:
For Eclipse:
The trick is, you need to clean & build the appcompat_v7 project. Go to
Project -> select Clean -> select the project.
After doing this, if the project does not get built automatically, right click on the project in the package explorer and select Build Project. Now the .jar file will be generated in the project's bin folder. After that, clean & build all projects that reference appcompat_v7.
Now the library should be correctly referenced by all projects that need it.
Note also that:
You must have the latest versions of SDK Tools / Build Tools
/ Platform Tools. If you try this and it doesn't work, then go to
the Android SDK Manager and make sure you have the latest versions of
the required tools.
In case your project only requires API level 14 (Ice Cream Sandwich)
& above, select API level 14 for "minimum required SDK" in the
project wizard when you create a new project. Now the appcompat_v7
library will not be required for this project, and the application
will use the native ActionBar class which is present in AOSP builds
from ICS onwards.
Further References:
1. How to add Android Support v7 libraries in eclipse.
2. Android actionbar how to add supporting library v7 appcompat for Eclipse.
3. android-support-v7-appcompat library project won't work.
4. Difference between android-support-v7-appcompat and android-support-v4.
The accepted answer worked for me but only after I'd installed the latest Java JDK (which was a solution to the problem detailed here Android - "Parsing Data for android-21 failed")
Need to update your SDK manager
click ur sdk manager icon in the ecilipse then update android support Repository in the extras
then
go to File->import->existing project
abt bundle->sdk->extra->android->support->v7 to workspace
after import v7 to workspace go to lib folder choose both jar and right click and choose build to workspace then again right click v7 project go to java build path choose the checkbox and click apply and ok..
if u have updated sdk then follow this steps
step 1:
Right click ur project then go to
property->choose java build path
step 2:
click Add External jar
Step 3:
Browse to ur adt bundle go to ur workspace choose the folder
android-support-v7-appcompat -> lib -> appcompat_v7.jar
Appcompat_7 error solved!
Hi, im a complete beginner, i solved my problem by go to SDK manager update/install all the new android sdk build tools (as im not sure which is which i should update/install so i update/install all the build tools. after updated/installed all the new build tools i closed my eclipse and relaunch the eclipse again. if you see any error again? go to the top bar click PROJECT and choose CLEAN. and run your application again and i think it will work fine..
it worked for me when i changed project build tarjet to API 21 for the android_support_v7_appcompact project
I had the same problem and I tried all of mentionded above advices and much more from, but no one helped me to solve my issue. My solution was creating a progect with minimum required SDK API 14: Android 4.0 (IceCreamSandwich). Doing this way Eclipse will not create appcompat_v7 project.
Also I found another, better, solution:
Go to Android SDK Manager and install Android 5.0.1 (API 21) or newer. If you don't use the emulator you can install only SDK Platform and Google APIs;
Go to appcompat_v7 -> Properties -> Android and check Android 5.0.1 in the Project Build Target;
Then go to Java Build Path -> Order and Export and check Android 5.0.1;
Do the same procedure for your project.
Strange fix but this worked for me ( My minimum SDK for my project is 10 - can't use 14)
Right-click on the "appcompat_v7" project and go to
-> Properties -> Android.
Your target build should already be set at the latest build (in my case Android 5.0.1). Click any other android package (apart from its current target) and click "Apply". Click "Ok" to close the box.
Re-open the Properties box by the same method but this time check the latest build (in my case Android 5.0.1) as the Project Build Target. Click "Apply", then "Ok" to close the box.
Clean the appcompat_v7 project. You'll probably need to clean/build all other projects that reference this library.
This solved it for me.
I was having with same Issue and fed up but finally I got the answer . I resolved this by Copy appcompat library E:\adt-bundle-windows-x86_64-20140702\sdk\extras\android\support\v7\appcompat and paste appcompat Library in the the Project which I want to Import . I close the Eclipse and reopen. But One thing I want to consider before these stuff I updated Android Support Repository and Android Support Library as well.
I solved it by downloading the file manually somewhere on the internet (be careful) and putting it into the needed \appcompat_v7\bin\ folder before creating a new Android project. After that, also my R.java file was generated successfully.
Honestly, no other way seemed to fix it. Could not obtain the file via the SDK manager.

Android:Error an Exclamation mark in my project how to resolve it

i got a pop up when i started my android eclipse stating that there is a new version which has to be upgraded for 22.6.2 version but your sdk is in 22.3 version even i had error that sdk is not installed in your eclipse so i went to help-> install software added repository then restarted my eclipse.
after that i added my code as usual to start coding my project but i got an exclamatory mark near my project when i compile dialog box appears as you have error in your project
Exclamatory mark shown in image
Next i went to show view -> problems . to check the problems i got an error stating about Android dependencies
next i went to quick fix the project but dialog box appeared
after fixing i got an error in jar file itself as shown below
in this we can check the errors
i am not able to resolve the error in the jar file can anyone help to resolve it
thanks for your time and help in advance
You need to reference AppCompat.
Download the support library under extras from Android sdk Manager.
AppCompat is located # android sdk/extras/android/support/v7/appcompat/
Import the library project into workspace.
Select File > Import.
Select Existing Android Code Into Workspace and click Next. Browse ( android sdk/extras/android/support/v7/appcompat/) and click finish
Right click on your project. Goto properties. Android. Add. Browse and Reference AppCOmpat.
Done.
Snaps
Library project imported to eclipse
Referenced AppCompat
You can try thus. Such as
You have updated the android sdk but not updated the adt to match with it.
You can update the adt from here
You might need to update the software source for your adt update
Go to eclipse > help > Check for updates.
It should list the latest update of adt. If it is not working try this
go to eclipse > help > Install new software
Click on add
add this url : update adt dynamically
give it any name.
It will list the updates available- which should ideally be adt 20.xx
Eclipse will restart and hopefully everything should work fine for you.

In-App Billing Android and bug

Good evening, everybody.
I'm trying to debug the In-App Billing project. The sourse which I use, is
https://github.com/blundell/SimpleInAppPurchaseV3
I'm facing the problem from time to time:
Suddenly the project in file Log.java gives two errors:
1. The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
The error shows near the first symbol of the file.
R.java cannit be resolved! And gen-folder doesn't recreate! No errors in xml-files.
IabHelper.java shows the error: The import com.android.vending.billing.IMarketBillingService cannot be resolved
So if delete com.android.vending.billing/IInAppBillingService.aidl file and recreate it (by copy-paste) nothing happens.
What am I doing wrong?
I think your problem is just the latest update of the SDK.
Test the following operations on two projects :
In the project properties (eclipse) -> java build path -> order and export make sure that all your jars in the libs folder are checked.
And "Android Tools -> Fix Project Properties"
And "Project -> Clean"
If your problem persists try this:
Remove your project
Close eclipse
Import your project again
I hope you have helped!
Try this one.
1) project properties-> java build path-> order and export
make sure you have checked true all files that I have listed below:
Android Private Libraries,
Android Dependencies,
your all jar and libraries you have added.
2) check your SDK manager you have updated all required versions for
--> Tools: SDK Tools, SDK platform tools, SDK build tools.
--> Android 4.2 or what ever you are using, Google Map and SDK Platform should be updated latest.
--> Extras: Google Play Services,Google play billing libraries
also make sure you have not imported wrong variables or any class.
Hope it will help you.
Simple solution.
Rename your package name from com.android.vending.billing to com.android.vending.billing2.
Refresh project.
And after that again rename to com.android.vending.billing. And it will work.
In Android Studio click "Make Project" after adding "IInAppBillingService.aidl" file to your project. Then Android Studio can import "IInAppBillingService" class after press Alt+Enter on IInAppBillingService class.

Running Android Support v4 Library Demo Programs

I'm interested in running the Android Support library demo projects for the v4 library.
Using the Android SDK manager I've installed the Eclipse plugins, and APIs from 2.2 to 4.0.1. There are several issues involved, and the sample project as provided is far from running on my configuration, as downloaded.
To reproduce this error:
Install SDK and Eclipse Juno
Import the sample v4 compatibility project using File --> New --> New Project and choose "from existing code", targeting, for example, the Support4Demos folder in <Android-sdk-path>/extras/android/support
Open the file AccessibilityManagerSupportActivity.java. The following errors appear.
Open res/values-v11/styles.xml. The following errors occur.
How do I get rid of these errors? I'd also like to understand why they are appearing so I can fix them in the future.
Thanks!
Clean solution is to:
Right-click your project.
Choose "Android Tools"
Choose "Add support library".
Install the appropriate support library (the newest)
I can't really answer you on the why this problem happens, but I'm guessing the Android team doesn't supply the Android support library, because it's changing all the time, so not to get stuck on some older version, they want us to supply it on our own.
If errors still persists or new errors come up, right-click the project again and choose "Android tool" -> "Fix project properties"
Update: In conjuction to my answer, the way to remove the rest of the errors is to import the project another way than you did.
Select File -> New -> Other
Click Next
Write Android Sample
Select Android sample Project and click Next
Now add the Android support librarys as described above.
You will get errors still however. To fix these, do the following:
Right-click your project and select "Properties"
Select Android
Select an SDK version equal to 3.0 or above
Select Ok and clean the project from the project menu.
All done ;-)
Now you won't be able to run the sample project on devices lower than Android 3.0.
The reason is because of some dependencies on some themes and settings, that wasn't added before Android 3.0 apparently.
It doesn't make sense why Google did this, but they did. You could try to remove the SDK +11 (Android 3.0) specific dependencies, but it will take some time - there are more errors than you actually see - especially in the XML files.
You have to add the v4 support library.
In order to do that , please follow these steps :
Select your project.
Click on Project from the menu.
Select Properties.
Click on Java Build Path.
Select the Libraries tab.
Click on Add External JARs.
Select the main directory of the Android SDK that you installed, then go to extras -> android -> support -> v4 , and then select android-support-v4.jar and click on Open.
Click OK.
This should remove the errors.
Please check your libs folder has android-support-v4.jar is present or not. if not add this jar file in libs folder.Just copy the android-support-v4.jar from any project and paste it to the libs folder of your project
I spent a whole night on this but can not solve this problem.
I finally solved the by accident: change some file in the demo and save, then change it back, this cleared all the errors. I think when you change some file and save, eclipse build the project and generate the R.java.

Categories