In my android project I tryed to use android.support.v4.widget.DrawerLayout
.
Before it I added it to the libs
library (cp MySdkForder/extras/android/support/v4/android-support-v4.jar MyProjectFolder/libs
)
After that I added it to the classpath
like this:
So I have a code like this in my main.xml
file
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ListView android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#111" />
</android.support.v4.widget.DrawerLayout>
This one I took somewhere on developer.android.com
Idea renders this code totally fine
Problems starts when I'm trying to launch it. When I press run
I have the following error from adb
Cannot reload AVD list: cvc-enumeration-valid: Value '280dpi' is not facet-valid with respect to enumeration '[ldpi, mdpi, tvdpi, hdpi, xhdpi, 400dpi, xxhdpi, 560dpi, xxxhdpi]'. It must be a value from the enumeration.
Error parsing /usr/lib/android/android-sdk-linux/system-images/android-22/android-wear/armeabi-v7a/devices.xml
cvc-enumeration-valid: Value '280dpi' is not facet-valid with respect to enumeration '[ldpi, mdpi, tvdpi, hdpi, xhdpi, 400dpi, xxhdpi, 560dpi, xxxhdpi]'. It must be a value from the enumeration.
Error parsing /usr/lib/android/android-sdk-linux/system-images/android-22/android-wear/x86/devices.xml
cvc-enumeration-valid: Value '280dpi' is not facet-valid with respect to enumeration '[ldpi, mdpi, tvdpi, hdpi, xhdpi, 400dpi, xxhdpi, 560dpi, xxxhdpi]'. It must be a value from the enumeration.
Error parsing /usr/lib/android/android-sdk-linux/system-images/android-22/android-wear/armeabi-v7a/devices.xml
cvc-enumeration-valid: Value '280dpi' is not facet-valid with respect to enumeration '[ldpi, mdpi, tvdpi, hdpi, xhdpi, 400dpi, xxhdpi, 560dpi, xxxhdpi]'. It must be a value from the enumeration.
Error parsing /usr/lib/android/android-sdk-linux/system-images/android-22/android-wear/x86/devices.xm
It looks like this
The funny thing is that I can't even close it (It appears again and again). But that's not my question. The question is how to make this android.support.v4
work? As I think I've done everything what I needed (added this library to libs
and made dependencies) and adb
still doesn't want to work (It works absolutely fine If I don't use android.support.v4
, just standard features)
I am using Genymotion and I don't need android wear images. I did following:
Uninstalled using SDK manager:
a) Android 5.1.1 (API 22) -> Android Wear ARM EABI v7a System Image
b) Android 5.1.1 (API 22) -> Android Wear Intel x86 Atom System Image
Removed all devices using AVD manager and create new one.
Works for me.
I just had this problem go here: usr/lib/android/android-sdk-linux/system-images/android-22
And remove the android wear folder.
Solution For android Studio.
Open sdk manager
delete Android Wear ARM EABI v7a System Image and Android Wear Intel x86 Atom System Image packet.
@gosha is told true.works for me.
Error Solution:-
- Uninstall Android Wear ARM EABI v7a System Image.
- Uninstall Android Wear Intel x86 Atom System Image.
Restart Android Studio...and enjoy!!
Delete these 2 packages using Android SDK Manager.
- ARM EABI v7a System Image
- Android Wear Intel x86 Atom System Image
View the image link here for more clarification.
http://i.stack.imgur.com/wq2tK.png
Use text editor to open Android\android-sdk\system-images\android-22\android-wear\armeabi-v7a\devices.xml
Search 280dpi
Change it to hdpi
Do the same for Android\android-sdk\system-images\android-22\android-wear\x86\devices.xml
Close eclipse. Restart eclipse. The error should disappear.
If you are working with windows, the files could be in
C:\Program Files (x86)\Android\android-sdk\system-images\android-22\android-wear\armeabi-v7a\devices.xml
C:\Program Files (x86)\Android\android-sdk\system-images\android-22\android-wear\x86\devices.xml
Looking at the error message, I suspect the problem is the setup of your Android Virtual Device, rather than anything with the project.
Have you tried running the project on an actual Android Device including the support library? If that works, there is not problem with your project setup.
If the problem is the AVD, as surmised, you need to go into your AVD manager and take a look at what the setup of your devices look like. I don't use VDs a lot myself, but one potential issue is that you may be missing the Google APIs in your setup.
Edit:
Just noted your clarification about using IntelliJ. It sounds like your project/IDE setup of the AVD has some issues. It is probably possible to hunt down and figure out the what has gone wrong by doing diffs on a working Android Studio project, but you'd probably save yourself a lot of time and effort by simply installing and using Android Studio. It's not very different, but there are enough Android-specific features in Studio that I think it is worth it even if it means you have two or more IDEs installed.
The cause of the error is the version of android being used by idea in it's android plug-in which is installed under plugins/android/lib/
.
I can see that this should be addressed in IDEA 15 as that will use a later version of android in the plug-in. That version has an entry for 280dpi
in it's devices-2.xsd that is packaged in the sdk-tools.jar.
I tried to hack the entry into the current devices-2.xsd but that causes the plug-in to completely fail later on. So don't try do do that!
If you aren't doing wear development, then the answers saying to remove those directories from the platform image are valid.
You can also live with the problem by positioning the annoying error dialogue so that it's ok button is over which ever element you are trying to click in Choose Device dialogue beneath it. Then double click. Tedious, but you do get there.
we can see the error: we can get the info, this error is about sdk/system-iamges/android-22/android-wear iamge.
So we can delete the sdk/system-iamges/android-22/android-wear directory. it works for me!