2012-04-30 12 views
1

このページからサンプルコードを開くにはどうすればいいですか?EclipseのFragmentBasics.zip(developer.android.com)?Eclipseで開く - コード

エラーが発生しました[2012-04-30 12:59:11 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] C:\ dev \ FragmentBasics \ AndroidManifestのパーサー例外.xml: "[xX] [mM] [1L]"に一致する処理命令のターゲットは許可されません。

Eclipseのバージョン:3.7.1

おかげ Bobert

+0

ここにスタックトレースをコピー/ペーストしてください。 –

答えて

0

あなたがたManifest.xmlを確認することができます。この例外は、一般に、白/後続の空白または不正なxml形式に関係します。 Altova/XMLエディタを使用してみてください。

0

私は同じ問題を抱えていたし、ファイルのAndroidManifest.xmlを編集しcopywriteコメントの上にライン<?xml version="1.0" encoding="utf-8"?>を移動することによってそれを解決:

<!-- 
Copyright (C) 2012 The Android Open Source Project 

パーサが先頭に<?xmlタグを読み取るために必要と思われますファイルの私はここにバグレポートを提出しました。結論としてhttp://code.google.com/p/android/issues/detail?id=30505&thanks=30505&ts=1336503159

、あなたのAndroidManifest.xmlファイルは次のようになります。プロジェクトがインポートされている

<?xml version="1.0" encoding="utf-8"?> 
<!-- 
Copyright (C) 2012 The Android Open Source Project 

Licensed under the Apache License, Version 2.0 (the "License"); 
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at 

    http://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and 
limitations under the License. 
--> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.android.fragments" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="15" /> 

    <application 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" > 
     <activity 
      android:name=".MainActivity" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
    </application> 

</manifest> 

たら、あなたは同じ問題を修正する必要がありますプロジェクト内の他のxmlファイル(res/layout/article_view.xml、res/layout/news_articles.xml、res/layout-large/news_articles.xml、res/values/strings.xml)

私は、src /ディレクトリに作成されたeclipseがcom.examples.android.fragmentsの代わりにcom.example.fragmentsというパッケージを見つけました。なぜそれが起こるのかわかりませんが、各ファイルのパッケージ宣言でエラーメッセージをクリックし、 'FILENAME.java'を 'com.example.android.fragments'パッケージに移動することで修正しました。

最後に、HeadlinesFragment.javaでandroid.os.Buildをインポートして、プロジェクトをコンパイルして実行する必要がありました。

関連する問題