Error at lib support appcompat_v7

前端 未结 4 1867
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-10 06:26

I am having trouble to at library appcompat_v7

It have error on path

res/values-v21/styles_base.xml

and at line 75 show erro

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-10 07:31

    Ok, I'm not sure, if this a real "solution" but here is my theory and what I did:

    My Theory

    After updating the "Android Support Library" version 21, I got a similar error. It seems, my IntelliJ didn't update the resources in my module correctly, which pointed to the ressources directory for appcompat.

    Furthermore, I had some widgets and Code that directly pointed to drawables in those ressources.

    But in v21 of the Android Support Library Google dropped support for the Holo theme!

    Hence, the compiler complains about not finding the resources my theme depends on.

    What I did

    When it compiled

    To be honest, I'm not really sure in how I came out making this work. I guess, I used did some restarting and cache emptying etc. Copying ressources to my project's folder etc. When my app finally started, it looked different! Of course, it had the Material theme instead of the Holo theme.

    And not everything survived this transition. E.g. the Action Bar was black (standard) instead of green (my theme). So I tried to go back to an old version of appcompat instead of migrating my whole app to Material.

    Since you asked me for my solution, I'm posting what I did to "downgrade" to appcompat v20.

    Downgrading to appcompat v20

    1. Start SDK Manager
    2. Download Android Support Repository
    3. Go to directory \android-sdk\extras\android\m2repository\com\android\support\appcompat-v7\20.0.0\ where Android SDK is installed
    4. Extract all files from appcompat-v7-20.0.0.aar (it's a zip file) to libs\appcompat\ directory in my project, after I created the directory appcompat
    5. Added these as a module in my IntelliJ and made my project depend on this module
    6. Recovered android-support-v7-appcompat.jar for v20 from my git repository
    7. Used the recovered appcompat jar instead of the v21 one

    Step 6 is the one, I found very difficult. I expected the classes.jar from the .aar file to be the android-support-v7-appcompat.jar, but it wasn't. I even don't know, where you can get the android-support-v7-appcompat.jar from in the right version because I didn't find it in the repository. And I didn't want to download it from "somewhere in the internet".

    I was "lucky", it already was in my git in the correct version.

    Now my app compiled and looked correctly. Hope so does yours!

提交回复
热议问题