Android Gossis Android Fragen Thread

Gossi

Bekanntes Mitglied
Hallo,

Ich weiß, dieser Fehler ist ziemlich bekannt, aber dennoch haben die Lösungen bei google nichts gebracht, hier erstmal ein bisschen Code:

Java:
import android.app.Activity;
import android.os.Bundle;

public class TestAppActivity extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(final Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
	}
}

[XML]
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android😱rientation="vertical" >

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />

</LinearLayout>
[/XML]

[XML]
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="hello">Hello World, TestAppActivity!</string>
<string name="app_name">TestApp</string>

</resources>
[/XML]

Folgende Lösungen habe ich bereits ausprobiert:
  • import android.R entfernt
  • Projekt clean und build
  • Die .xml-Files verändert und neu gespeichert
  • Neues Projekt angelegt
  • Run versucht

Das hat aber alles nicht geholfen, Eclipse erzeugt die R.java Klasse nicht, bei mir ist gem eh komplett leer, ich weiß langsam echt nicht mehr weiter, hoffe ihr könnt mir helfen.

Gruß Gossi
 
Zuletzt bearbeitet von einem Moderator:
Hmm, jetzt hab ich ein neues Problem, nach dem (Per Refactor) umbennenen einer Klasse (TestApp) in "StaumeldungErfassen" bekomme ich folgenden fehler:

[2012-04-20 10:51:09 - TestApp] ERROR: Unknown command 'crunch'
[2012-04-20 10:51:09 - TestApp] Android Asset Packaging Tool
[2012-04-20 10:51:09 - TestApp]
[2012-04-20 10:51:09 - TestApp] Usage:
[2012-04-20 10:51:09 - TestApp] aapt l[ist] [-v] [-a] file.{zip,jar,apk}
[2012-04-20 10:51:09 - TestApp] List contents of Zip-compatible archive.
[2012-04-20 10:51:09 - TestApp]
[2012-04-20 10:51:09 - TestApp] aapt d[ump] [--values] WHAT file.{apk} [asset [asset ...]]
[2012-04-20 10:51:09 - TestApp] badging Print the label and icon for the app declared in APK.
[2012-04-20 10:51:09 - TestApp] permissions Print the permissions from the APK.
[2012-04-20 10:51:09 - TestApp] resources Print the resource table from the APK.
[2012-04-20 10:51:09 - TestApp] configurations Print the configurations in the APK.
[2012-04-20 10:51:09 - TestApp] xmltree Print the compiled xmls in the given assets.
[2012-04-20 10:51:09 - TestApp] xmlstrings Print the strings of the given compiled xml assets.
[2012-04-20 10:51:09 - TestApp]
[2012-04-20 10:51:09 - TestApp] aapt p[ackage] [-d][-f][-m][-u][-v][-x][-z][-M AndroidManifest.xml] \
[2012-04-20 10:51:09 - TestApp] [-0 extension [-0 extension ...]] [-g tolerance] [-j jarfile] \
[2012-04-20 10:51:09 - TestApp] [--min-sdk-version VAL] [--target-sdk-version VAL] \
[2012-04-20 10:51:09 - TestApp] [--app-version VAL] [--app-version-name TEXT] [--custom-package VAL] \
[2012-04-20 10:51:09 - TestApp] [--rename-manifest-package PACKAGE] \
[2012-04-20 10:51:09 - TestApp] [--rename-instrumentation-target-package PACKAGE] \
[2012-04-20 10:51:09 - TestApp] [--utf16] [--auto-add-overlay] \
[2012-04-20 10:51:09 - TestApp] [-I base-package [-I base-package ...]] \
[2012-04-20 10:51:09 - TestApp] [-A asset-source-dir] [-G class-list-file] [-P public-definitions-file] \
[2012-04-20 10:51:09 - TestApp] [-S resource-sources [-S resource-sources ...]] [-F apk-file] [-J R-file-dir] \
[2012-04-20 10:51:09 - TestApp] [raw-files-dir [raw-files-dir] ...]
[2012-04-20 10:51:09 - TestApp]
[2012-04-20 10:51:09 - TestApp] Package the android resources. It will read assets and resources that are
[2012-04-20 10:51:09 - TestApp] supplied with the -M -A -S or raw-files-dir arguments. The -J -P -F and -R
[2012-04-20 10:51:09 - TestApp] options control which files are output.
[2012-04-20 10:51:09 - TestApp]
[2012-04-20 10:51:09 - TestApp] aapt r[emove] [-v] file.{zip,jar,apk} file1 [file2 ...]
[2012-04-20 10:51:09 - TestApp] Delete specified files from Zip-compatible archive.
[2012-04-20 10:51:09 - TestApp]
[2012-04-20 10:51:09 - TestApp] aapt a[dd] [-v] file.{zip,jar,apk} file1 [file2 ...]
[2012-04-20 10:51:09 - TestApp] Add specified files to Zip-compatible archive.
[2012-04-20 10:51:09 - TestApp]
[2012-04-20 10:51:09 - TestApp] aapt v[ersion]
[2012-04-20 10:51:09 - TestApp] Print program version.
[2012-04-20 10:51:09 - TestApp]
[2012-04-20 10:51:09 - TestApp] Modifiers:
[...]
[2012-04-20 10:51:09 - TestApp] ERROR: Unknown option '--no-crunch'
[2012-04-20 10:51:09 - TestApp] Android Asset Packaging Tool
[...]
[2012-04-20 10:51:09 - TestApp] level is set to 7 or higher where the default encoding is UTF-8.
[2012-04-20 10:51:09 - TestApp] Unknown error: Unable to build: the file dx.jar was not loaded from the SDK folder!
[2012-04-20 10:54:48 - TestApp] ERROR: Unknown command 'crunch'
[2012-04-20 10:54:48 - TestApp] Android Asset Packaging Tool
[2012-04-20 10:54:48 - TestApp]
[2012-04-20 10:54:48 - TestApp] Usage:
[2012-04-20 10:54:48 - TestApp] aapt l[ist] [-v] [-a] file.{zip,jar,apk}
[2012-04-20 10:54:48 - TestApp] List contents of Zip-compatible archive.
[...]
[2012-04-20 11:06:02 - TestApp] --rename-instrumentation-target-package
[2012-04-20 11:06:02 - TestApp] Rewrite the manifest so that all of its instrumentation
[2012-04-20 11:06:02 - TestApp] components target the given package. Useful when used in
[2012-04-20 11:06:02 - TestApp] conjunction with --rename-manifest-package to fix tests against
[2012-04-20 11:06:02 - TestApp] a package that has been renamed.
[2012-04-20 11:06:02 - TestApp] --utf16
[2012-04-20 11:06:02 - TestApp] changes default encoding for resources to UTF-16. Only useful when API
[2012-04-20 11:06:02 - TestApp] level is set to 7 or higher where the default encoding is UTF-8.
[2012-04-20 11:06:02 - TestApp] Unknown error: Unable to build: the file dx.jar was not loaded from the SDK folder!

Ich habe bereits bei "platform-tools" nach der dx.jar gesucht, diese auch gefunden. Im Internet bin ich auf die Lösung gekommen, die dx.jar mit der dx.jar aus dem (platform)/tools/lib Ordner zu ersetzen, auch das hat nicht geholfen, weiß jemand woher dieser Fehler kommen könnte?

Was ich auch nicht verstehe "a package that has been renamed.", dabei wurden die Packagenamen behalten...

PS:
Ich arbeite gerade das Buch "Android Grundlagen und Programmierung" durch
 
Zuletzt bearbeitet:
Moin,

Ich bin moentan dabei, eine art Notizplaner zu erstellen. Jetzt komme ich aber zu folgendem Problem (bitte bringt mich für den Code nicht um)

Ich führe für jeden TextView der hinzugefügt werden soll folgendes aus:

Java:
if (((EditText) findViewById(R.id.newNote)).getText().length() > 0) {
	TableRow tr = new TableRow(this);
	tr.setLayoutParams(new TableRow.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	TextView tv = new TextView(this);
	tv.setLayoutParams(new TableRow.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	tv.setText(((EditText) findViewById(R.id.newNote)).getText()
			.toString());
	tr.addView(tv);
	((TableLayout) findViewById(R.id.tabelleNotizen)).addView(tr,
			new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT,
					LayoutParams.WRAP_CONTENT));
	((TableLayout) findViewById(R.id.tabelleNotizen)).invalidate();
	((EditText) findViewById(R.id.newNote)).setText("");
}

Wie kann ich den einzelnen Rows jetzt einen LongKlickListener hinzufügen?

PS:
Den fehler mit dem dx.jar File hab ich damit gelöst, das ich den ganzen android Kram nochmal runtergeladen habe.
 
Zuletzt bearbeitet:

Zurück
Oben