今天在我匯入一些安卓專案的原始碼的時候會出現style.xml 和MAIN.xml 等錯誤, 網上的方法試了各種clean各種fix等方法都是不能解決。最後去國外論壇得到解決
阿新 • • 發佈:2019-02-19
方法如下
首先,沒有R檔案是個大問題。佈局有錯誤
檢視 res/values/styles.xml 下的報錯點。
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
把這個改成
<style name="AppBaseTheme" parent="android:Theme.Light">
路徑: res/values-11/styles.xml
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
把這個改成
<style name ="AppBaseTheme" parent="android:Theme.Holo.Light">
路徑: res/values-14/styles.xml
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
把這個換成
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
main.xml中
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never"/>
把這個中的app換成android
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
android:showAsAction="never" />
等讀完workspace後R檔案還沒出來的clean一下就好了