• ベストアンサー
※ ChatGPTを利用し、要約された質問です(原文:Andoroidプロジェクトのインポート)

Androidプロジェクトのインポートでエラーが発生し実行・ビルドができない

このQ&Aのポイント
  • Androidプロジェクトをeclipseの『既存のプロジェクトをインポート』を使ってインポートする際にエラーが発生し、実行・ビルドができない問題があります。
  • 検索しても海外のサイトしかヒットせず、英語の読めない私にはさっぱりわかりません。どなたか教えてくださいお願いします。
  • [2011-08-14 02:39:48 - NiseSakura] (skipping index file 'C:\Documents and Settings\Takumi\workspace\NiseSakura\res\drawable\Thumbs.db') [2011-08-14 02:39:48 - NiseSakura] C:\Documents and Settings\Takumi\workspace\NiseSakura\res\values\strings.xml:20: エラー: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute? [2011-08-14 02:39:48 - NiseSakura] C:\Documents and Settings\Takumi\workspace\NiseSakura\res\values\strings.xml:20: エラー: Unexpected end tag string

質問者が選んだベストアンサー

  • ベストアンサー
  • bluehat43
  • ベストアンサー率52% (9/17)
回答No.1

strings.xml というファイルの20行目に、書式が間違えてる箇所があるというエラーですね。 AndroidSDKのバージョンがr08から、strings.xml の書式が変更されましたので、恐らくですけどそれよりも下のバージョンのAndroidSDKで作成されたプロジェクトをr08以降のバージョンを適用したプロジェクトにインポートしようとしてるのでは? それ自体、特別問題という事はありません。strings.xmlのエラーさえ解消すればビルドできるようになるはずです。 よくあるのは置換文字列に関するエラーです。 例えば20行目が <string name="message1">%sと%sはお休みです</string> となっていたとします。この状態で、アプリから置換文字に"土"と"日"を渡してあげると 「土と日はお休みです」 という文字列が生成されます。 昔まではこの書式でよかったのですが、置換文字列が1つのstring中に複数ある場合は、以下のようにしなければならなくなりました。 <string name="message1">%1$sと%2$sはお休みです</string> それぞれの置換文字列に番号をつけるようになりました。$sの部分は、文字列であれば$s、数値であれば$dとする必要があります。

shitujigumo
質問者

お礼

お礼が遅れてしまい申し訳ありません。 PCの調子が悪くなってしまったのでまだ試していませんが、とても参考になりました。 ありがとうございます。

全文を見る
すると、全ての回答が全文表示されます。

関連するQ&A

  • お気に入りのインポート

    誤ってお気に入りのデータを消してしまったので お気に入りのインポートをしようとしているのですが、 インポート元の C:\Documents and Settings\NY\My Documents\NData\Favorites\bookmark.htm が見つからないと言うエラーが出て前に進めません。 確かに「お気に入り」は存在し、登録したお気に入りが 数多く入っているのですが……。 そのようにすれば、インポートできますか?。 ご教示ください。

  • メールのインポートができない

    win98からXPに買い替え、受信メールをインポートしようとしましたが、「メッセージがありません。」とエラーが出てしまいます。 なので、C:\Documents and Settings\(ユーザー)\Local Settings\Application Data\Identities\{・・}と受信トレイのある場所を検索しそこにドラッグドロップしようとしましたが、が:「Local Settings」がみつかりません。ユーザーのフォルダにもないですし、検索しても見つからないのです。 パソコンはあまり詳しくないので、困っています。 よろしくお願いします。

  • サーブレットの設定

    web.xmlの記述方法を教えてください。 画面のフォームからの入力で、サーブレットに飛ばそうとしています。 IDEとしてeclipseを使っています [環境] tomcat5.5 eclipse3.2 [index.html] http://localhost:8080/newPackage/ にアクセス→画面OK → フォームを送信 <html> <head> <form method= POST action=newPackageClass> <input type="text" name="id1" value="入力してください"> <input type="submit"> </form> </head> </html> [server.xml] <Context path="/newPackage" reloadable="true" docBase="C:\Documents and Settings\name\workspace\newPackage" workDir="C:\Documents and Settings\name\workspace\tomcatProject\work" /> [web.xml] <servlet> <servlet-name>newPackageServlet</servlet-name> <servlet-class>newPackageClass</servlet-class> </servlet> <servlet-mapping> <servlet-name>newPackageServlet</servlet-name> <url-pattern>/newPackageClass</url-pattern> </servlet-mapping> [newPackageClass.javaおよびnewPackageClass.class] 場所:newPackageプロジェクト直下(デフォルトパッケージの中) //適切なimport public class newPackageClass extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { //略 } public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { doGet(req, res); } } このように実装したところ、「The requested resource (/newPackage/newPackageClass) is not available.」 と出ました。 このためserver.xmlは問題がなく、 web.xmlのservlet-classに問題があるような気がします。 もし原因が分かりましたら教えてくださいませ。

    • ベストアンサー
    • Java
  • XML ドキュメントには最上位の要素を指定する必要があります。リソース

    XML ドキュメントには最上位の要素を指定する必要があります。リソース 'file:///C:/Documents and Settings/****/デスクトップ/Schedule_1014.xml' の実行エラーです。 これはなんでしょうか?どのようにすれば消えますか、消せますか?

  • Androidコンパイル時のエラーについて

    Androidの開発中に下記エラーが出ます。 対処の解る方がおりましたらば教えていただけますでしょう 宜しくお願いいたします。 詳細内容及びソース、XML エラー 2011-05-11 16:09:27 - BMICalculator2] res\layout\main.out.xml:0: Originally defined here. [2011-05-11 16:09:27 - BMICalculator2] C:\workspace\BMICalculator2\res\values\strings.out.xml:1: エラー: Error parsing XML: no element found [2011-05-11 16:09:27 - BMICalculator2] C:\workspace\BMICalculator2\res\layout\main.out.xml:1: エラー: Error parsing XML: no element found [2011-05-11 16:09:27 - BMICalculator2] C:\workspace\BMICalculator2\res\layout\main.xml:38: エラー: エラー: No resource found that matches the given name (at 'id' with value '@id+/button_calculate'). [2011-05-11 16:09:28 - BMICalculator2] res\layout\main.xml:0: エラー: Resource entry main is already defined. [2011-05-11 16:09:28 - BMICalculator2] res\layout\main.out.xml:0: Originally defined here. [2011-05-11 16:09:28 - BMICalculator2] C:\workspace\BMICalculator2\res\values\strings.out.xml:1: エラー: Error parsing XML: no element found [2011-05-11 16:09:28 - BMICalculator2] C:\workspace\BMICalculator2\res\layout\main.out.xml:1: エラー: Error parsing XML: no element found [2011-05-11 16:09:28 - BMICalculator2] C:\workspace\BMICalculator2\res\layout\main.xml:38: エラー: エラー: No resource found that matches the given name (at 'id' with value '@id+/button_calculate'). ソース package com.mamezou.android.bmi.alc; import android.app.Activity; import android.os.Bundle; public class BMICalculatorActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } string.XML <?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello">Hello.Wopld.BMICalculatorActivity</string> <string name="app_name">BMI Calculator</string> <string name="label_description">BMIを計算します</string> <string name="label_height">身長(cm)</string> <string name="label_weight">体重(kg)</string> <string name="button_calculate">計算</string> </resources> main.XML <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/label_description" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/label_height" /> <EditText android:id="@+id/text_height" android:layout_width="fill_parent" android:layout_height="wrap_content" android:numeric="integer" android:maxLength="3" android:text="160" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/label_weight" /> <EditText android:id="@+id/text_weight" android:layout_width="fill_parent" android:layout_height="wrap_content" android:numeric="integer" android:maxLength="3" android:text="50" /> <Button android:id="@+id/button_calculate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_calculate" /> </LinearLayout>

  • server.xmlの設定

    開発環境 Windows XP Tomcat 4.1.31 Eclipse 2.1.3 Eclipseを使ってJSPの開発をはじめたのですがEclipseのフォルダをJSPの仮想ディレクトリに設定するところでうまくいかず困っています。 server.xmlに以下を追加しました。 <Context path="/myWeb" docBase="C:\Documents and Settings\Administrator\My Documents\NOMURA \eclipse\workspace\TEST001_01\myWeb" workDir="C:\Documents and Settings\Administrator\My Documents\NOMURA \eclipse\workspace\TEST001_01\j2src\org\apache\jsp" reloadable="true"/> この状態で http://localhost:8080/myWeb/index.jsp にアクセスしても404エラーでページが表示されません。 Tomcatをインストールし、 http://localhost:8080 にてindex.jspが表示されることは確認できました。 また、jspファイル自体は C:\Documents and Settings\Administrator\My Documents\NOMURA\eclipse\workspace\TEST001_01\myWeb の下に置いています。 ファイルに問題があるのかもと思い、http://localhost:8080/index.html にて表示できたindex.htmlファイルをmyWebフォルダの下に置いてみたのですが、やはりだめでした。 何か設定が足りていないのでしょうか? どなたか教えてください。よろしくお願いします。

    • ベストアンサー
    • Java
  • antについて

    antを実行すると次のようなエラーが出ます。なぜでしょう? C:\Documents and Settings\Tnigawa\sen-1.2.2.1\dic>ant Buildfile: build.xml init: compile: BUILD FAILED C:\Documents and Settings\Tnigawa\sen-1.2.2.1\dic\build.xml:47: Execute failed: java.io.IOException: CreateProcess: cpp -P C:\Documents and Settings\Tnigawa\sen -1.2.2.1\dic\src\java/net/java/sen/util/DoubleArrayTrie.cpp error=2

    • ベストアンサー
    • Java
  • DVD Flickのエラーについて

    今DVD Flickでニコニコから落とした動画を焼いていたんですが、↓のようなエラーが出ました。 何が原因なのかわかりません。誰か教えてください。 C:\Documents and Settings\(User)\My Documents\DVD\dvdauthor.xml:1: parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0x8B 0x7B 0x88 0xE4 <dvdauthor dest="C:\Documents and Settings\(User)\My Documents\DVD\dvd"> ^ ERR: Error in parsing XML ちなみに(User)は日本語です。

  • 送信済みトレイの内容をインポートするには?

    outlook express で送信済みトレイが不調になった為、送信済みアイテム.dbxを削除し復活をしました。しかし送信済みには残しておきたい文章もあるため、「C:\Documents and Settings\user\Local Settings\Application Data・・・・」にある送信済みアイテムから再度インポートできればと思っています。がやり方がわかりません。わかる方、宜しくお願い致します。

  • Thunderbirdでのメールのインポート

    Thunderbird2.0をインストールしました。 WindowsVistaを使っています。 NetscapeMailからメールボックスをインポートしたいのですが 方法はありますでしょうか?(手作業でも‥) Thunderbirdのメールは、どこに保存されるのでしょう? Vistaでは¥Documents and Settingsフォルダーがありません。 教えてください。お願いします♪