2014-10-28 196 views
-1

請幫助我。 我在解決這個錯誤超過3天時遇到了問題Android 5.0不支持較低版本

我沒有得到正確的解決方案。 我已經更新了我的eclipse以運行android 5.0。

我已經創建了一個簡單的Android應用程序,使用最低版本16和目標版本21來運行Android 5.0素材主題。 添加了主題styles.xml像這樣

<resources> 
    <!-- inherit from the material theme --> 
    <style name="AppTheme" parent="android:Theme.Material"> 
    <!-- Main theme colors --> 
    <!-- your app branding color for the app bar --> 
    <item name="android:colorPrimary">@color/primary</item> 
    <!-- darker variant for the status bar and contextual app bars --> 
    <item name="android:colorPrimaryDark">@color/primary_dark</item> 
    <!-- theme UI controls like checkboxes and text fields --> 
    <item name="android:colorAccent">@color/accent</item> 
    </style> 
    </resources> 

我跟着鏈接添加支持庫appcompatv7。 http://developer.android.com/tools/support-library/features.html#v7

但是我得到錯誤,指出每當我這個程序兼容性添加到我的項目R可以不被解析爲變量 。 請給我一個建議,也請分享您的Android 5.0在較低版本的項目中運行。

回答

0

閱讀compatibility爲材料的主題,並添加程序兼容性到您的項目庫,你可以在

sdk\extras\android\compatibility\v7\appcompat

您style.xml

<style name="AppBaseTheme" parent="Theme.AppCompat"> 
0

主題找到。 xml應該是這樣的。

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <style name="AppTheme" parent="AppTheme.Base"/> 

    <style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar"> 
     <item name="colorPrimary">@color/grey_main</item> 
     <item name="colorPrimaryDark">@color/grey_main</item> 
     <item name="android:windowNoTitle">true</item> 
     <item name="windowActionBar">false</item> 
    </style> 
</resources> 
0

檢查mainactivity.java。 可能不會產生你r.java文件,這樣你可能會得到錯誤提的R可以解決不了

必須添加程序兼容性添加到您的項目庫

sdk\extras\android\compatibility\v7\appcompat 

添加AppBaseTheme

<style name="AppBaseTheme" parent="Theme.AppCompat"> 
相關問題