Is Android Support Reposity includeable in Eclipse Neon? - android

for certain compatibility reasons, I have to use Eclipse Neon for Android Development to develop an android app. Therefore I also have to use the newest Android SDK so I can implement some newest features.
Now, I am facing the problem that I cannot compile any Android app with Eclipse, because I get errors like
The import android.support cannot be resolved
ActionBarActivity cannot be resolved to a type
Error retrieving parent for item: No resource found that matches the given name "ThemeAppCompat. …"
upon building. As I found out, this is because Eclipse is missing the "Android support library" (android support library.jar ?) in the sdk folder. The reason for this is, as I found out, that this library is obsolete and has been replaced by the "Android support repository". It has not been installed by the Android SDK manager and cannot be installed anymore, but Eclipse still needs it apparently.
I searched a lot for a solution for this but all answers I could find was "Swtich to Android Studio"… Unfortunately, there is no way around using Eclipse for me. Is there any known way to include the support repository and make eclipse use it? I found this site
https://developer.android.com/topic/libraries/support-library/setup.html
and thought, maybe I can follow these steps to make my app to a gradle.build and then include the stuff from the repository and get my stuff to work, but unfortunately I could not find a way to realize this.
I changed the related section in the gradle.build file to this:
…
dependencies {
…
compile 'com.android.support:appcompat-v7:24.0.0'
}
…
but could not get the app being built.
Is there any known solution for this? I actually cannot imagine that I am the only one trying to develop an Android App with the new support repository file these days. Should I maybe manually insert the obsolete (but newest) android support library.jar file from an older IDE? Could this work?
Thank you many times for your help.

Related

Compiling and using AppCompatActivity in Eclipse

I have the latest Android Support Library, Android Support Repository and Google Repository (Rev. 23.1, 24, 22 respectively) and working with Eclipse Mars.1(4.5.1)
In the process of giving a make-over to an existing app, I am trying to import the v7.AppCompatActivity library, closing all other projects in workspace and silent prayers. ( ;-) )
Observations:
I daresay I have been unsuccessful even after following the instructions here to the dot.
Ian Lake's blog looks all hunky-dory, but Utopian.
Reading up tons of excellent answers on SO did not yet help. No matter what target is set in the project.properties page or what Build Target is set in the Eclipse Project Properties dialog - just cannot seem to get rid of this (and very similar) compile error(s):
android-support-v7-appcompat\res\values-v23\styles_base.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Going by the number of similar questions, I am surely not alone. Pray, can someone kindly throw some light on how to import the v7 support library without going insane?
Thanks in advance!
None of the answers or blogs pointed out the following, except #pkuszewski.
The above issue resolves on
upgrading to Android 6 Marshmallow API 6.0 with the SDK manager
setting the Build Target for the AppCompat project to Android 6.0
Did I hear, "Duh"? :)
Thanks, #pkuszewski!
SDK Manager fragment looks like this, post the fix:

Gradle and Android v7 compat issue

I have problems compiling my Android app with Gradle. I'm a newbie with Gradle, so...
It seems that Gradle cannot resolve correctly v7 compat library. This is the code where I use it:
MenuItemCompat.setOnActionExpandListener(mSearchItem,
new MenuItemCompat.OnActionExpandListener() {
#Override
public boolean onMenuItemActionCollapse(MenuItem item) { ...}
And this is the error I get from Gradle:
C:\>gradlew build
error: cannot find symbol
new MenuItemCompat.OnActionExpandListener() {
^
symbol: class OnActionExpandListener
location: class MenuItemCompat
I can build this from Android Studio smoothlessly.
I've tried adding the compat library jar manually to my lib directory and adding a dependency in the gradle.build file but it doesn't work.
Problem is probably the missing appcompat repo in your Android SDK.
Probably you are using 2 instances of gradle and Android SDK. Android Studio comes bundled with it's own Android SDK, so updating this wont change your previous installed one. Also normally you would start a Gradle project in Android Studio with a Gradle-Wrapper that handles manageing the gradle instance on its own (usually it will get downloaded into your %USER%/.gradle folder)
I also guess you downloaded gradle and that instance is what you use through the commandline. So to fix this just update your none-android studio android sdk (also check all the repos)
More to the Issue:
Android Library Projects won't get bundled as a jar since they need additional resources. The format for this is AAR, which to my knowledge cannot be build directly as for now. Also the gradle android plugin does not work with local AARs, only from maven/ivy repositories (this is a design descion and on purpose)
Finally, I found the issue, thanks to for3st.
Well, I didn't know that Android Studio SDK Manager and the SDK Manager that I downloaded on my own from the android web page did not refer to the following. That's the main issue here. Other issues were related to the problem:
I had such an old version of Android Studio (0.2) that I had to upgrade manually with the zip installer applying the patch. It seemed to work fine, but I'm not absolutely sure, so I uninstalled it and installed Android Studio 3.2 from the android developer site, then used the IDE mechanism to upgrade to 3.6. From now on, I'll enjoy easier upgrades.
Then I got lots of issues with Gradle, related to the version and all that, so I downloaded from the Gradle site the 1.8 version, placed somewhere in my disk, edited Android Studio settings to use this and edited the "gradle-wrapper.properties" to use the proper version.
More issues I got were due to downloading the required API versions that I targeted in my project, as well as matching the minSdkVersion and targetSdkVersion in AndroidManifest.xml and gradle.build files.
Then I checked my project structure and made the correct adjustments or added the "sourceSets" section in my build.gradle files.
Finally, I copied my third party dependencies (joda.time, android.v4 support) to my lib folder.
I'm not sure which one solved the issue, but all of this solved it for sure. I decided to put all this in order to help someone who gets stucked. Use this as a checklist.

Adding Support Libraries to Android project

Why am I having such a hard time getting into the swing of Android development? I've been developing in various languages over the years and, for some reason, just can't seem to get beyond that "jeez-i-still-feel-a-total-noob" stage with Android.
So I'm trying to add an Action Bar to my Android 2.3.3 project. No problem, right? The Android developers website has a nice and clear article explaining exactly how to do it. Of course it involves adding the appcompat v7 support library. No problem, even this is documented step-by-step on this page. But, as with just about every such exercise in Android, I find that you can do exactly what the page tells you to do, it still won't work without significant amount of Googling to fix the errors that you encounter afterwards.
So I've followed the steps under "Using Eclipse" in the section "Adding libraries with resources" in the above link. The first error I get is Unable to resolve target 'android-16'. No problem, this one I could figure out for myself but I'm curious, is there anything in the documents I've been following that would have suggested to me that I need Android 4.1.2 (API16) installed? Did I just read right over it or should I have known by myself that, to do what I'm trying to do, I would need API16?
Never mind, at least I can fix that but then I get a new problem. As soon as I add the android-support-v7-compat library to my project and click the OK button, the console output lights up with errors, the first one being:
C:...\android-support-v7-appcompat\res\values-v14\styles_base.xml:24:
error: Error retrieving parent for item: No resource found that
matches the given name 'android:Widget.Holo.ActionBar'.
and the other 60 odd errors are similar but for different given names.
I would really appreciate if anyone could help me out here. Obviously I'd like to know how to solve this particular problem but if anyone could give me some tips on how to get past this very frustrating stage of learning this new development environment, I would be ever so thankful. What is it that I should have done differently not to run into these kinds of errors, other than following the instructions on the Android Developers website step by step?
OK, I guess I should post an answer as I've eventually managed to solve my own problem.
It turns out I have to use a build target of Android 4.2.2, regardless of the fact that I'm specifically developing for Android 2.3.3 - I mean, that's why I'm using support libraries after all. I imagine it might be possible that some other lower target (but higher than 2.3.3) would still work I just used the highest one I have installed and it solved the problem.
How I was supposed to know this from following the step-by-step instructions on the Android Developers website is a mystery to me. The reason I decided to try changing the targetSdkVersion was because of the final section in the page referenced in the question. It reads "If you are increasing the backward compatibility of your existing application to an earlier version of the Android API with the Support Library, make sure to update your application's manifest." Now I'm not increasing the backward compatibility of my existing application. I'm changing an existing application that targets 2.3.3 to be able to include an Action Bar (seems more like "forward compatibility"). I tried upgrading the targekSdkVersion though as I was out of ideas and lo and behold, it worked.
Don't know if it helps you at all, but I've been struggling with a similar issue for several hours and finally managed to resolve it. In my case, inside my own project's styles.xml file, I was referencing the AppCompat style in the wrong way in the parent attribute.
I was using:
<style name="AppBaseTheme" parent="android:Theme.AppCompat">
where I should have used:
<style name="AppBaseTheme" parent="#style/Theme.AppCompat">
My mistake was in the reference to the theme.
I found that setting the Android target to 2.3.3 for the library project android-support-v7-appcompat solves this issue. You don't need to set your project's target higher, but the library's target lower.
You have pinpointed the all important document and the relevant section "adding libraries with resources":
http://developer.android.com/tools/support-library/setup.html
The error suggests that your project is not able to find these resources. Please double check the following :
You have checked "is library" on the library project
You have exported the jars IN THE LIBRARY PROJECT as described in that section
You have added the library project as a reference to your app project
You have added the android-support-v4.jar to your libs folder in your app project
If this is all definitely correct, check eclipse for any error messages - is it the library project or the app project that lights up like the proverbial Christmas Tree ?
First of all check if you have done all the described steps as explained on the developers site. Then, for the errors :
Unable to resolve target 'android-16'
Make sure that you have installed API16, this errors occurs if you have mentioned your targetsdk to 16 in your Manifest while the sdk for API16 is not installed. You can either install the API or edit the targetApi of your project to the minimum required version, for the support library you are using I think API 11 is the minimum required android version.
android:Widget.Holo.ActionBar
This error should also be fixed once the targetsdk is fixed in your project. Since to use Holo.ActionBar you'l need to target your project to minimum supported api level ie. 11 or higher.
I met similar problems. Using API 18, ADT.
To solve the "Unable to resolve target 'android-16' problem", I remove the import lib project and repeat what the tutorial says.
Then I found I couldn't really "add" the library to my project. (The instruction "In the Library pane, click Add." there is not that detail.
1. In your project -> properties -> Java build path -> Libraries -> Add Library... -> Android Classpath Container -> Select the lib project
2. In your project -> properties -> Android -> add... -> choose the lib -> apply
cheers
Here is how I avoided the error, " Unable to resolve target 'android-16'", when adding v7.
First, I followed the instructions for adding support libraries with resources in eclipse. Following step 4, I clicked Finish. That's when I saw the error message, android-support-v7-appcompat] Unable to resolve target 'android-16'.
Second, I read this post. I also opened the download manager, but did not need anything updated. In order to make sure that I followed the steps exactly as correctly as I could, I deleted the android-support-v7-appcompat project and started over.
This second time I didn't check any different boxes, after all. But, I also got no errors at step 4. Who can say why?
Thanks, Dewald, you expressed in this question the same frustration I have. Is experience the only way out?
If some of your resource xml files cannot find their respective AppCompat references, make sure you also add the support libraries to your project properties. You do this by:
1.) right clicking on your project in the project
2.) Select properties. (Bottom of the menu)
3.) click Android on the left hand side menu of the new pop up window
4.) In the libraries section, click the "add button"
5.) Select the respective libraries. (If none show up, check to see if they are already displayed in the "libraries" window of the pop up menu. If there is a red x by the desired library, try and resolve that issue first.)
6.) Once there is a green checkmark next to the desired libraries, make sure the "Is Library" option in the libraries section IS NOT selected.
7.) Click apply.
8.) Close the pop up menu.
If this doesn't work, let me know and I can help you out. I spent three hours on the problem so I know pretty much all the possible things that can go wrong with the set up.
Go to Project -> uncheck Build Automatically
Go to Project -> Clean... , clean both the library project and your app project
Export your app as a signed APK while Build Automatically is still disabled

ViewPager.PageTransformer cannot be resolved to a type

I am getting ViewPager.PageTransformer cannot be resolved to a type I have updated the sdk to the latest and have the latest version of android-support-v4 in my libs folder and i read this post ViewPager.PageTransformer showing error ViewPager cant rersolved to a type i am using androidsupportv4 jar revision 9 and did the same steps but it didn't work.
You should remove ViewPager. from the begginging of declaration.
So, that would looks like just PageTransformer
Plus, import android.support.v4.view.ViewPager.PageTransformer;
that worked perfect for me.
Okay, I found the solution. You need to update your Android Support Library package. But if you have it now you need to uninstall it first then install it again in order to get new one.
If you have IntellijIdea:
Open SDK Manager window from "Tools/Android/SDK Manager"
Find Exteras folder then check Android support library. If its status is
installed click "Delete 1 package..." in order to delete it.
Check this package and click on install button.
Navigate to \extras\android\support\v4 then copy
android-support-v4.jar and paste it into your Libs folder.
Idea should recompile the project automatically, however if it didn't do
that then you should recompile it manually by click on
"Build/Rebuild Project"
That's it ;)
Realized I never answered this question. To solve this I grabbed the android-support-v4 from another computer and it worked. This could have the same effect as uninstalling and re-installing but i didn't try it.
At one point I had also found myself with the same issue. Apparently it is because whenever I decide to launch the Android SDK Manager within Eclipse I had been excluding an important step in the update process.
I always 'uncheck' the 'installed' option when trying to update. It was always my assumption that since the other checkmark labelled 'new/updates' would keep the updates visible to the installation. This actually is not the case though. Once I left 'installed' check-marked I saw updates from previously installed components. Then I was able to install the missing features that I thought were already up-to-date on my computer.
Hopefully, you find this helpful for getting the latest. It was misleading to me.
--Edit--
After getting the latest however, the post you referenced was what ended up resolving the issue for me however. I did not find a quick efficient way to sync with the latest version of the compatibility library. It is probably because on creation of the application it copies int he latest version locally into a project. So, you have to manually copy over the latest compatibility library.
Be sure to copy over the latest compatibility library however to all other supporting Android libraries that it also depends on as well. Otherwise you will get build errors with the new compatibility library in you local project settings.
You will need to get the Version 18 of the Android Support Library.
Make sure to update to that version using the SDK manager and then copy "android-support-v4.jar" and "android-support-v13.jar" to "libs" folders of your project.
That should take care of the issue.
Update your android support library from sdk manager.
Copy the android-support-v4.jar from \sdk\extras\android\support\v4 to your project's libs folder.
import android.support.v4.view.ViewPager.PageTransformer
Change ZoomOutPageTransformer implements ViewPager.PageTransformer to ZoomOutPageTransformer implements PageTransformer.
Thats it all errors will be gone and the animation works really well.

xmlvm - import errors compat libs in xcode

Does anyone know where the android compat libary is
located in xmlvm so I could copy it by myself to the project folder because this is
what I guess is missing, also would be provided by target=android-on-iphone but as mentioned below this target isn't available in the current build.
I had absolutely no problem installing xmlvm and getting in touch with the
demo/samples also all the demos worked perfectly for me.
But now im stuck at the last 4 errors in xcode, i migrated my android project via --
skeleton=android:migrate then cross-compiled it via --target=iphone and opened
up the project in Xcode. after few project setup changes the errors went down from
72 to 4 errors ;)
however the errors are importing file not found errors of compat libs, so this
should somehow get to be solved i think...
is it because --target=android-on-iphone wasnt used by me because this option
will copy the android compat libary to the project folder.. well i tried to use this
target mentioned in 2 documentations of xmlvm but in the actual build of xmlvm
this target however does not exist..
How to solve these errors?
Screenshots:
http://img526.imageshack.us/img526/8957/bildschirmfoto20120620u.png
http://imageshack.us/f/138/bildschirmfoto20120620u.png/
From what I can see, it looks like you are using part of the Android API which is not yet implemented.
Unfortunately it seems that you either need to rewrite your application or implement the API yourself.

Categories

Resources