Android "Hello World" Error - java

I'm new to Android development. I'm running Eclipse with the ADT plugin and installed all the necessary dependencies. I open up Eclipse, select 'New Android Applciation' and everything is set. When I run the app, I get an error message saying
/home/parallels/workspace/test/AndroidManifest.xml: 2: /home/parallels/workspace/test/AndroidManifest.xml: Syntax error: newline unexpected
So I look in Android Manifest and it's just the default, Eclipse generated code, right? What's the problem here?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.test.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>

Is there any empty space above your first line in your manifest? That has to be at the very top. Also have you compiled anything successfully thus far? Maybe something didn't get imported properly. I recommend android studio. It's just Googles modified version of eclipse that specializes in android development. It comes with everything you need all ready to go.

Related

My app gets the error "Unfortunately, App has stopped." every time I load it

I was initially trying to add a splash page to my app, and followed a tutorial on how to do so. However, now every time I load my app, it does to a white screen for a few seconds before saying "Unfortunately, [App] has stopped."
I was unable to find a way to copy LogCat, so here's an image of the errors which appear:
Also, here's my Manifest XML:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bipbapapps.leagueclickerapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".Splash"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainClass"
android:label="#string/app_name">
<intent-filter>
<action android:name="com.bipbapapps.leagueclicker.CLICKER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
Deleting the splash Java and activity from the manifest does nothing to help now (and when I deleted it, I did revert MainClass to .LAUNCHER .
Can anyone make sense of the list, and/or help me run my app again?
From the logs, I found that you should
Call the requestFeature before setContentView();
The error says it you are calling setContentView() before requestFeature(). Don't do it.
LogCat should show you the problem. Click on all the error lines in the LogCat until you will be redirected to the problem.
I, myself, found that your problem could be at: Splash.java, line 19
Go check it out, hope it helps!

I have AAPt error on my Android xml file: Tag <category> attribute has invalid character

I have an Android xml file that includes splash and one another activity ım planıng to pass one to another while using ınytent in this context I created a default and launcher category
but eclipse is giving me error that: Tag <category> attribute has invalid character
(actually there is no invalid character)
here is my xml code
(boldline is the line that error occurred)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tesbih"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.tesbih.TesbihMainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
**<category android:name="android.intent.category.DEFAULT "** />
</intent-filter>
</activity>
<activity
android:name="com.tesbih.Splash"
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>
here is also my logcat
Description Resource Path Location Type
The value of the local variable timer is not used Splash.java /Tesbih/src/com/tesbih line 15 Java Problem
Tag attribute name has invalid character ' '. AndroidManifest.xml /Tesbih line 21 Android AAPT Problem
the reason of thıs problem is a bug that bundle has. if you save everythıng and exit
then when you open agaın you should go your xml fıle after makıng anychanges on the name of android name you can save and re exit again when you open your eclipse and android manifest your error sign will be lost

Android SDK VS Facebook R class conflict?

Okay first of all what I am doing is trying to integrate my Android game which is fully functional and tested to be working code onto Facebook.
I have been following the Facebook tutorial on how to set it up for Facebook and have been using the Android SDK version of the support v4 file.
The problem I have been having seems to be a conflict between the two SDK's.
R cannot be resolved to a variable.
For example
MediaPlayer song = MediaPlayer.create(this.getContext(), R.raw.ironman);
R.raw.ironman is where the problem occurs, which is a reference to the raw folder in my resources directory, where the mp3 file ironman is found.
It uses the R class which is part of the Android SDK
I had my game setup this way and it works great until I try to add the features from the tutorial.
For example
if (user != null)
{
TextView welcome = (TextView) findViewById(R.id.welcome);
welcome.setText("Hello " + user.getName() + "!");
}
R.id.welcome
This uses the R class which is part of the Facebook SDK for accessing a control the way it looks.
Another thing I noticed was that it keeps deleting my Java files as well.
from what I have read on other posts on here this is due to problems with the XML file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.SmashEm"
android:versionCode="2"
android:versionName="2.1" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#drawable/thumb"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:configChanges="orientation|keyboardHidden"
android:name="com.example.SmashEm.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>
<meta-data android:value="#string/app_id" android:name=" com.facebook.sdk.ApplicationId"/>
<activity android:name="com.facebook.LoginActivity" android:label="#string/app_name"></activity>
</application>
</manifest>
Maybe I am going about this all wrong but I just thought I would give this a try.
Any help would be a appreciated and thanks.
Also I am pretty sure this is different then all the other threads I read so far but I could be wrong since I am not an expert in Java.

See only home screen and not my app when running the App

I'm really freaking out of this problem, I've tried anything. Nothing works. When I run the app, android emulator just loads, shows the home screen and then nothing happens (I don't see my app running), just nothing. What should I do?
EDIT: Console code shows:
[2012-07-04 00:20:17 - MyAPPP] Android Launch!
[2012-07-04 00:20:17 - MyAPPP] adb is running normally.
[2012-07-04 00:20:17 - MyAPPP] Performing com.exame.myappp.MainActivity activity launch
[2012-07-04 00:20:17 - MyAPPP] Automatic Target Mode: launching new emulator with compatible AVD 'MonoForAndroid_API_8'
[2012-07-04 00:20:17 - MyAPPP] Launching a new emulator with Virtual Device 'MonoForAndroid_API_8'
LogCat doesn't show anything
EDIT2: Manifest as requested :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.exame.myappp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
this could be an issue with Eclipse, sometimes when I run eclipse I have the same problem where the emulator runs, my app fails to run and when I try to run the app again I have a new emulator running. What I usually find myself doing is build/clean the project, restart eclipse and then start again.
Sorry for the old techie "off/on" answer, hope it sorts itself out.
Make your manifest look like this:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.exame.myappp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

Android - "The server could not process your apk. Try again.." error when uploading on market

So this is my Android Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.xxxxxxxxxxxxxxxx"
android:versionCode="3"
android:versionName="1.02">
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar" >
<activity
android:name=".XXXXXXXXXActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".XXXXXXXXXXXXXXXX"></activity>
</application>
</manifest>
Each time I upload to the android market, I get the error:
The server could not process your apk. Try again..
I previously uploaded a few APKs, but now I decided to downgrade my app, because it works on 2.1, previously it was on minimum 2.3. And since i've changed the minSdkVersion it doesn't want to upload anymore.
Looks like Android market is down. If you look carefully, you will see that upload does not even happen. So that error message is misleading you. Lets wait till Google resolves this.
#o2genum
I reported the problem here:
https://support.google.com/androidmarket/developer/bin/request.py?contact_type=bugs
(under "problems with the developer console")
And sent them the URL to this report
Edit:
Just saw this in the console:
22 February 2012: Application uploading and editing issues.
We are aware of issues with uploading and editing applications in the Android Market Developer Console. We apologize for this inconvenience and are working to fix this as soon as we can.

Categories

Resources