[英]Intellij IDEA not recognizing Android library resources
我已將Google Play服務作為庫項目添加到Intelli-J中的Android項目中,但是看來IDE仍無法識別資源。 當應用嘗試為地圖充氣時,出現以下錯誤:
ERROR/AndroidRuntime(16002): FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
這是布局XML中片段的代碼。
<fragment
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="200dp"
class="com.google.android.gms.maps.SupportMapFragment"
map:cameraZoom="13"
map:mapType="normal"
map:uiCompass="false"
map:uiRotateGestures="true"
map:uiScrollGestures="false"
map:uiTiltGestures="true"
map:uiZoomGestures="true" />
在Google Play項目的maps_attrs.xml
中, <declare-styleable name="MapAttrs">
“ MapAttrs”用紅色突出顯示。
在Eclipse中編譯時,代碼可以正常運行。
有誰知道如何使IDEA識別資源?
通過從Android重新安裝Google Play服務,在Eclipse中進行編譯,然后將其重新連接到我的IDEA項目,並將google-play-services-lib的R.java輸出重定向到虛擬目錄,我找到了解決方法將google-play-services模塊的Android界面的“編譯器”標簽下的R.java輸出目錄從“ ... / gen”更改為“ ... / _ gen”)。 我仍然不太確定是什么原因造成的。
看來JetBrains將在12.1中更改此行為:http: //youtrack.jetbrains.com/issue/IDEA-99045
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.