Simple Hello Android.....not workign - android

EDIT: SOLVED I JUST HAD TO WAIT FOR AWHILE
So I followed the simple "Hello Android" tutorial:
http://developer.android.com/resources/tutorials/hello-world.html
got everything set up fine.....stuff works but when I go to actually run it.....it just says "Android_" in my virtual device....
I tried running it on 2.1 2.2 2.3.1 and 2.3.3 VD's and get the same thing?
package com.example.helloandroid;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
}
}
Any ideas? My first venture into android is a failing one ;_;
PIC:
bigger:http://img.photobucket.com/albums/v720/bmw_pyro/Untitled-2.png
MANIFEST:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.helloandroid"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="10" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".HelloAndroid"
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>

"Android _" is the first loading emulator splash screen, so you are saying that you get stuck there? If that's the case, that has nothing to do with your code.

Related

Parse Error: There was a problem parsing the package

I try to resolve this error from various methods in my Hello World App.These are;
-Go to Security-->Unknown sources.
-Go to About phone-->Build number.
-Update my manifest file whose picture is given below.
-Test app both on phone Y625 Huawei and on tablet T1-701u tab.
-Reboot android phone and android studio (version 3.4.1).
-Transfer apk file via data cable or airmove software.
But none of them works to solve the issue.
I develop my Hello World. Firstly i faced insufficient heap size error issue which has solved on the temporary basis. After build up my app, Parsing the package issue has emerged.
Manifest File:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hw04">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
MainActivity.java
package com.example.hw04;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Parse Error
There was a problem parsing the package enter code here

Custom Application class onCreate() never called

I'm trying to initialize Parse on a custom Application class:
import android.app.Application;
import android.util.Log;
import com.parse.Parse;
import com.parse.ParseException;
import com.parse.ParseInstallation;
import com.parse.SaveCallback;
public class SomeApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
initializeParse();
}
private void initializeParse() {
Parse.setLogLevel(Parse.LOG_LEVEL_VERBOSE);
Parse.initialize(new Parse.Configuration.Builder(this)
.applicationId("##########")
.clientKey("############")
.server("https://#####.com/parse/")
.build()
);
ParseInstallation installation = ParseInstallation.getCurrentInstallation();
installation.saveInBackground(new SaveCallback() {
#Override
public void done(ParseException e) {
// Do something here
}
});
}
}
And I already declare this Application in AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.someproject">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".SomeApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".AnotherActivity"/>
</application>
</manifest>
But my custom Application is never called. I tried to put logs and break points on onCreate method, clean project, rebuild project, close and re-open Android Studio, uninstall and reinstall the app and nothing ... so, I need help.
Thanks!
Disable Instant Run, Clean build, Rebuild the project and then run again.
I had the same issue. Disabling instant run worked for me. It is weird Application class not getting called. But it happened.
In my case I forgot about declaration in the manifest:
<application
android:name=".App"
...>
This worked for me - try using this property in your Manifest file:
<application
android:name=".SomeApplication"
android:usesCleartextTraffic="true"

Can't launch app in AVD

I am a new android programmer.
I created a simple "Hello World" app in android studio, but when I run it on an AVD, it gives the following error:
Unexpected error while executing: am start -n "com.example.ahrims.helloworld/com.example.ahrims.helloworld.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while Launching activity
EDIT 1:
Here is the manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ahrims.helloworld">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<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>
Edit 2:
The following is MainActivity file:
package com.example.ahrims.helloworld;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
I googled it, but did not find any useful answer.
Any help would be appreciated.
Thanks in advance.
Remove the .idea folder and gradle folder, then click "sync project with gradle" gradle files, after this process finished, you are able to run your app

ACRA error reporting failed

I am using famous ACRA Error reporting tool to send crash logs to document which I have uploaded on my Google Doc.
I have followed all below steps mentioned in
https://github.com/ACRA/acra/wiki/BasicSetup
But still my application does not send error reports to document which I have uploaded.
I could see following error logs generated by ACRA.
01-01 02:11:19.995: E/ACRA(6054): ACRA caught a RuntimeException
exception for com.example.arcasample. Building report.
Below is my source code which I believe is flawless.
MyApplication.java
package com.example.arcasample;
import org.acra.ACRA;
import org.acra.ErrorReporter;
import org.acra.annotation.ReportsCrashes;
import android.app.Application;
#ReportsCrashes(formKey = "XXXX")
public class MyApplication extends Application
{
#Override
public void onCreate()
{
// ErrorReporter.getInstance().init(this); This is not helping me
ACRA.init(this);
super.onCreate();
}
}
MainActivity.java
package com.example.arcasample;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class MainActivity extends Activity
{
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
int a = 10 / 0; <= This will cause crash.
Log.i("vipul", "" + a);
}
}
manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.arcasample"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="MyApplication"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.arcasample.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>
Can someone please let me know if I am missing anything.
Thanks in advance.
Well I tried deleting form created on Google docs and recreated it.I wonder what mistake i had done before?.
Anyways recreating form and carefully noting down form key resolved my issue.

ActionBarSherlock - SherlockActivity issue - Couldn't find content container view

I've done the setup as described for ActionBarSherlock. I've also added ABS as a library project and believe this is working as expected as Eclipse is finding references to class's within it's packages. I've also set the theme as required in the code and in the AndroidManifest.xml:
Code:
import com.actionbarsherlock.app.SherlockActivity;
public class TestClass extends SherlockActivity{
Context myContext;
public void onCreate(Bundle savedInstanceState) {
setTheme(R.style.Theme_Sherlock_NoActionBar);
super.onCreate(savedInstanceState);
setContentView(R.layout.test);
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.danieljgmaclean.xxx"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/px_icon"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock.Light" >
<activity
android:name="TestClass"
android:label="#string/app_name"
android:noHistory="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
However apon execution i'm getting the following exception thrown:
Caused by: java.lang.RuntimeException: Couldn't find content container view
This is being called on:
com.danieljgmaclean.xxx.TestClass.onCreate(TestClass.java:23)
I'm running the code on a 2.3.3 emulator and i've set the target build to 4.0.3 and JDK version to 1.6.
Any ideas would be appreciated.
In my case the problem was a "raw" folder inside res which contained the db of the app. So I just removed the folder and the actionbar worked again. Now the problem is that I need the raw...

Categories

Resources