Adding Support Libraries to Android project

后端 未结 9 1338
孤街浪徒
孤街浪徒 2020-12-31 00:43

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 s

相关标签:
9条回答
  • 2020-12-31 00:51

    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

    0 讨论(0)
  • 2020-12-31 00:53

    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?

    0 讨论(0)
  • 2020-12-31 00:56

    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.

    0 讨论(0)
  • 2020-12-31 01:00

    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

    0 讨论(0)
  • 2020-12-31 01:11

    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.

    0 讨论(0)
  • 2020-12-31 01:13

    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.

    0 讨论(0)
提交回复
热议问题