问题
I've recently built an Android app with a minSdkVersion of 7 and targetSdkVersion of 10. I'm now making the app tablet compatible and adding action bars. So I updated by targetSdkVersion to 15 and in my project properties, moved my Project Build Tarket to Android 4.0.3, API 15. I also double-checked that my Java Compiler is 1.6.
Without making any other changes to my code, I try to run my app and in the Android Device Chooser, my two physical devices, versions 2.3.4 and 3.1, both have a red X in the Target column, instead of the green check mark.
I'm also working with the ActionbarCompat sample app and a sample app from ActionbarSherlock and when I run one of those apps, both of my devices, show a green check mark. Both of these sample apps have their Project Build Target set to 4.0.3 and the same sdkVersion settings that I have in my app. As far as I can tell, my app is setup the same as the others. Why does my app then have a red X next to my device versions in the Target column.
Thanks!
回答1:
In Eclipse, after changing the minSdkVersion and targetSdkVersion
if the "Android Device Chooser" still shows the Red X on the Devices (which should be compatibles). Try:
- Open the "Debug Configuration" or "Run Configuration" Dialog
- Remove all the configurations under "Android Application"
- Retry Right-Click on the Project > Debug As > Android Application
All compatible devices should turns to the green check mark now.
回答2:
It's becuase your devices are running Android versions 2.3.4, and 3.1, so you must have minSdkVersion="10" at the very least. Once you set the minSdkVersion to 10, then you'll get the green check mark again.
回答3:
AndroidManifest.xml:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15" />
If your manifest have a higher "targetSdkVersion" than your device, it will show a "red cross(X)" next to the firmware.
If your minSdkVersion is higher that your device it will not even run
UPDATE:
I tested the sample project and got the same results as my answer clarified since the beginning. (image of the project running with same specifications as the question)
来源:https://stackoverflow.com/questions/11978600/android-device-chooser-shows-red-x-in-target-column