Android用のネイティブ拡張機能を構築しています.レイアウトからプロパティにアクセスしようとすると、Googleマップビューを統合しようとしています. エラーは、マップビューを拡張するアクティビティ クラスに表示されます。
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Remove title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_map);
mapView = (MapView)findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true); // <- this crashes, same for textview etc.
読み込まれた xml は次のようになります。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/textfield1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:text="@string/hello_world"
android:textColor="#ff0000" />
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="300dp"
android:layout_height="300dp"
android:clickable="true"
android:apiKey="0cy94dNyuBcfF0aNZhB_JKpF4dQtxgDWhCXppRw" />
<Button
android:id="@+id/button_clear"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_width="100dp"
android:layout_height="40dp"
android:background="@android:color/black"
android:text="@string/clear"
android:textColor="@android:color/white" />
<Button
android:id="@+id/button_add"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_width="100dp"
android:layout_height="40dp"
android:background="@android:color/black"
android:text="@string/add"
android:textColor="@android:color/white" />
これまでに見つけて確認したこと:
- xml レイアウトのマップ ビューが正しく表示されるため、拡張機能が正しく読み込まれます。
- res-folder がコピーされ、ANE (解凍チェック済み) と APK (解凍チェック済み) にコンパイルされます。
- すべてのレイアウト要素に問題が存在し、テキストビューへのアクセス時にもアプリがクラッシュします。マップ固有の問題ではないので
- プロジェクトはスタンドアロンで実行すると正常に動作するため、拡張機能に関するものでなければなりません
getRessourceId の使用に関するいくつかの投稿を読んだことがありますが、それは FREContext をアクティビティに挿入する必要があることを暗示しています。
ヒントは本当にありがたいです!ありがとう、M.