I have 2 classes: Main and Study. when I press the "study" button on the Main's layout it should go to the Study class but the application crashes instead.
this is the Main class Code:
package com.example.geograpp;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
public class Main extends Activity implements OnClickListener {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
View studyButton=this.findViewById(R.id.study_button);
studyButton.setOnClickListener(this);
}
#Override
public void onClick(View v) {
switch (v.getId()){
case R.id.study_button:
Intent studyIntent = new Intent(this, Study.class);
startActivity(studyIntent);
break;
}
}
}
this is the Main's layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".Main"
android:background="#drawable/mainmenu_background">
<Button
android:id="#+id/study_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="94dp"
android:text="Study"
android:textColor="#color/white"
android:textSize="22sp"
android:background="#color/black"/>
<Button
android:id="#+id/about_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/game_button"
android:layout_below="#+id/game_button"
android:layout_marginTop="40dp"
android:background="#color/black"
android:text="About"
android:textColor="#color/white"
android:textSize="22sp" />
<Button
android:id="#+id/game_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/study_button"
android:layout_below="#+id/study_button"
android:layout_marginTop="38dp"
android:background="#color/black"
android:text="Game"
android:textColor="#color/white"
android:textSize="22sp" />
<Button
android:id="#+id/exit_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/about_button"
android:layout_alignRight="#+id/study_button"
android:layout_below="#+id/about_button"
android:layout_marginTop="42dp"
android:background="#color/black"
android:text="Exit"
android:textColor="#color/white"
android:textSize="22sp" />
</RelativeLayout>
This is the Study class code:
package com.example.geograpp;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class Study extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_study);
}
}
This is the Study's layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".Study"
android:background="#drawable/study_background">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="106dp"
android:text="Choose a Continent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/white" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:src="#drawable/worldmap_clickable" />
</RelativeLayout>
This is the manifast
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.geograpp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="10" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.geograpp.Main"
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="com.example.geograpp.Study"
android:label="#string/title_activity_study" >
</activity>
</application>
</manifest>
The log cat after the crush:
09-04 22:54:17.176: D/dalvikvm(334): GC_EXTERNAL_ALLOC freed 49K, 53% free 2551K/5379K, external 1625K/2137K, paused 135ms
09-04 22:54:45.306: D/dalvikvm(334): GC_EXTERNAL_ALLOC freed 12K, 53% free 2577K/5379K, external 23321K/25369K, paused 62ms
09-04 22:54:45.396: E/dalvikvm-heap(334): 22216740-byte external allocation too large for this process.
09-04 22:54:45.496: E/GraphicsJNI(334): VM won't let us allocate 22216740 bytes
09-04 22:54:45.506: D/dalvikvm(334): GC_FOR_MALLOC freed <1K, 53% free 2577K/5379K, external 23321K/25369K, paused 35ms
09-04 22:54:45.506: D/skia(334): --- decoder->decode returned false
09-04 22:54:45.506: D/AndroidRuntime(334): Shutting down VM
09-04 22:54:45.506: W/dalvikvm(334): threadid=1: thread exiting with uncaught exception (group=0x40015560)
09-04 22:54:45.538: E/AndroidRuntime(334): FATAL EXCEPTION: main
09-04 22:54:45.538: E/AndroidRuntime(334): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.geograpp/com.example.geograpp.Study}: android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
09-04 22:54:45.538: E/AndroidRuntime(334): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.os.Handler.dispatchMessage(Handler.java:99)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.os.Looper.loop(Looper.java:123)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.app.ActivityThread.main(ActivityThread.java:3683)
09-04 22:54:45.538: E/AndroidRuntime(334): at java.lang.reflect.Method.invokeNative(Native Method)
09-04 22:54:45.538: E/AndroidRuntime(334): at java.lang.reflect.Method.invoke(Method.java:507)
09-04 22:54:45.538: E/AndroidRuntime(334): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-04 22:54:45.538: E/AndroidRuntime(334): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-04 22:54:45.538: E/AndroidRuntime(334): at dalvik.system.NativeStart.main(Native Method)
09-04 22:54:45.538: E/AndroidRuntime(334): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
09-04 22:54:45.538: E/AndroidRuntime(334): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
09-04 22:54:45.538: E/AndroidRuntime(334): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.app.Activity.setContentView(Activity.java:1657)
09-04 22:54:45.538: E/AndroidRuntime(334): at com.example.geograpp.Study.onCreate(Study.java:12)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
09-04 22:54:45.538: E/AndroidRuntime(334): ... 11 more
09-04 22:54:45.538: E/AndroidRuntime(334): Caused by: java.lang.reflect.InvocationTargetException
09-04 22:54:45.538: E/AndroidRuntime(334): at java.lang.reflect.Constructor.constructNative(Native Method)
09-04 22:54:45.538: E/AndroidRuntime(334): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
09-04 22:54:45.538: E/AndroidRuntime(334): ... 21 more
09-04 22:54:45.538: E/AndroidRuntime(334): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
09-04 22:54:45.538: E/AndroidRuntime(334): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.content.res.Resources.loadDrawable(Resources.java:1709)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.View.<init>(View.java:1951)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.View.<init>(View.java:1899)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.ViewGroup.<init>(ViewGroup.java:286)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.widget.RelativeLayout.<init>(RelativeLayout.java:173)
09-04 22:54:45.538: E/AndroidRuntime(334): ... 24 more
09-04 22:55:01.926: I/Process(334): Sending signal. PID: 334 SIG: 9
Your application is crashing because your apps allowed memory limit has been exceeded. The only way to resolve this problem is to reduce the memory footprint of your app. My guess is your entire issue is related to the background set in your study layout.
android:background="#drawable/study_background"
Images are almost always the cause of OutOfMemory errors in my experience. Take a look at the resolution of this image and try to scale it down to a more appropriate size for mobile. One way to test if this is the issue is to remove the background line altogether and run the app. If you don't see any errors or the error you do see isn't the same you know the image is causing your memory problems.
To explain how I came to that conclusion take a deeper look at the last caused by line in your stack trace:
09-04 22:54:45.538: E/AndroidRuntime(334): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
09-04 22:54:45.538: E/AndroidRuntime(334): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.content.res.Resources.loadDrawable(Resources.java:1709)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.View.<init>(View.java:1951)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.View.<init>(View.java:1899)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.ViewGroup.<init>(ViewGroup.java:286)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.widget.RelativeLayout.<init>(RelativeLayout.java:173)
If you look its during a constructor call to a RelativeLayout and is running out of memory while it is trying to decode a bitmap. Higher up in the stack trace you see it causes an error inflating xml. This means that the problem occurred when the Android system was trying to turn your xml into java objects and draw this on screen. You explained you were seeing this problem when your code was trying to move to the study activity which would indicate that the issue lies somewhere in the xml for study activity. Your study activity xml only has a single RelativeLayout with a background set on it indicating this is where the problem lies.
Finally I'd like to point out you also have a bitmap set on the image view which could also need to be sized more appropriately for mobile.
android:src="#drawable/worldmap_clickable"
Related
I would get google map on my emulator.
I followed the instructions on
When I run the application an error's message appears:Unfortunately DemoGoogleMapsV2 has stopped.
my androidmanifest.xml:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<permission android:name="com.demogooglemapsv2.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.demogooglemapsv2.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- The following two permissions are not required to use
Google Maps Android API, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="API_KEY"/>
<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>
my activity_main.xml:
<android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
my MainActivity.java:
package com.demogooglemapsv2;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
the log error:
09-04 17:43:51.170: E/Trace(1477): error opening trace file: No such
file or directory (2) 09-04 17:43:53.449: E/AndroidRuntime(1477):
FATAL EXCEPTION: main 09-04 17:43:53.449: E/AndroidRuntime(1477):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.demogooglemapsv2/com.demogooglemapsv2.MainActivity}:
android.view.InflateException: Binary XML file line #11: Error
inflating class fragment 09-04 17:43:53.449: E/AndroidRuntime(1477):
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
09-04 17:43:53.449: E/AndroidRuntime(1477): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
09-04 17:43:53.449: E/AndroidRuntime(1477): at
android.app.ActivityThread.access$600(ActivityThread.java:141) 09-04
17:43:53.449: E/AndroidRuntime(1477): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
09-04 17:43:53.449: E/AndroidRuntime(1477): at
android.os.Handler.dispatchMessage(Handler.java:99) 09-04
17:43:53.449: E/AndroidRuntime(1477): at
android.os.Looper.loop(Looper.java:137) 09-04 17:43:53.449:
E/AndroidRuntime(1477): at
android.app.ActivityThread.main(ActivityThread.java:5041) 09-04
17:43:53.449: E/AndroidRuntime(1477): at
java.lang.reflect.Method.invokeNative(Native Method) 09-04
17:43:53.449: E/AndroidRuntime(1477): at
java.lang.reflect.Method.invoke(Method.java:511) 09-04 17:43:53.449:
E/AndroidRuntime(1477): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
09-04 17:43:53.449: E/AndroidRuntime(1477): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 09-04
17:43:53.449: E/AndroidRuntime(1477): at
dalvik.system.NativeStart.main(Native Method) 09-04 17:43:53.449:
E/AndroidRuntime(1477): Caused by: android.view.InflateException:
Binary XML file line #11: Error inflating class fragment 09-04
17:43:53.449: E/AndroidRuntime(1477): at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
09-04 17:43:53.449: E/AndroidRuntime(1477): at
android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 09-04
17:43:53.449: E/AndroidRuntime(1477): at
android.view.LayoutInflater.inflate(LayoutInflater.java:489) 09-04
17:43:53.449: E/AndroidRuntime(1477): at
android.view.LayoutInflater.inflate(LayoutInflater.java:396) 09-04
17:43:53.449: E/AndroidRuntime(1477): at
android.view.LayoutInflater.inflate(LayoutInflater.java:352) 09-04
17:43:53.449: E/AndroidRuntime(1477): at
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
09-04 17:43:53.449: E/AndroidRuntime(1477): at
android.app.Activity.setContentView(Activity.java:1881) 09-04
17:43:53.449: E/AndroidRuntime(1477): at
com.demogooglemapsv2.MainActivity.onCreate(MainActivity.java:17) 09-04
17:43:53.449: E/AndroidRuntime(1477): at
android.app.Activity.performCreate(Activity.java:5104) 09-04
17:43:53.449: E/AndroidRuntime(1477): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
09-04 17:43:53.449: E/AndroidRuntime(1477): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
09-04 17:43:53.449: E/AndroidRuntime(1477): ... 11 more 09-04
17:43:53.449: E/AndroidRuntime(1477): Caused by:
java.lang.IllegalStateException: The meta-data tag in your app's
AndroidManifest.xml does not have the right value. Expected 5089000
but found 0. You must have the following declaration within the
element: 09-04
17:43:53.449: E/AndroidRuntime(1477): at
com.google.android.gms.common.GooglePlayServicesUtil.A(Unknown Source)
09-04 17:43:53.449: E/AndroidRuntime(1477): at
com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown
Source) 09-04 17:43:53.449: E/AndroidRuntime(1477): at
com.google.android.gms.maps.internal.u.I(Unknown Source) 09-04
17:43:53.449: E/AndroidRuntime(1477): at
com.google.android.gms.maps.internal.u.H(Unknown Source) 09-04
17:43:53.449: E/AndroidRuntime(1477): at
com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
09-04 17:43:53.449: E/AndroidRuntime(1477): at
com.google.android.gms.maps.SupportMapFragment$b.jz(Unknown Source)
09-04 17:43:53.449: E/AndroidRuntime(1477): at
com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
09-04 17:43:53.449: E/AndroidRuntime(1477): at
com.google.android.gms.dynamic.a.a(Unknown Source) 09-04 17:43:53.449:
E/AndroidRuntime(1477): at
com.google.android.gms.dynamic.a.onInflate(Unknown Source) 09-04
17:43:53.449: E/AndroidRuntime(1477): at
com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown
Source) 09-04 17:43:53.449: E/AndroidRuntime(1477): at
android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:291)
09-04 17:43:53.449: E/AndroidRuntime(1477): at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
09-04 17:43:53.449: E/AndroidRuntime(1477): ... 21 more
Replace FragmentActivity in place of Activity, make sure you are entering right api key.
And in place of
com.google.android.gms.maps.MapFragment
use
com.google.android.gms.maps.SupportMapFragment
Make sure google play services is installed on your device. That's why try to run the application on real device not on the emulator.
Add the following activity_main.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"
/>
</LinearLayout>
add this tag in your menifest file
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Hope your project and google-play-services_lib both are in same workspace and you have added it as library project in your application. If your API-Key is ok then you need to change like this.
1. add this meta-data inside application tag in manifest
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
2. As minSdkVersion="8" you should use SupportMapFragment so activity_main.xml looks like this
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>
3. Instead of Activity you should extend FragmentActivity and use SupportFragmentManager()
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
GoogleMap mMap = fm.getMap();
}
}
Try to run it on real device or Genymotion's emulator after installing
google-play-service. Otherwise you will face a crash
Ok, so I've got my Android application and it wont boot with a "unable to instantiate activity ComponentInfo{}" error, basically theres something wrong in my manifest file that won't let the application launch the first activity. I made a new but essentially duplicated project (manually copying across the Java+XML code for Main, second + third 'tester' activities, and of course Strings). I left the manifest of the new project as it is but added the activity lines for the tester. I wanted everything as stock basically so nothing could go wrong, and nothing did, the application loaded on emulator and my phone alright.
So I copy the new manifest to my old project in an effort to 'default' it, and I copy and pasted the tester activity code that was already there and worked, for the other 3 activity's. Suddenly it doesn't want to work. Everything is there, but what's the problem? (note the icon drawable is changed but that's nothing to do with it). All the activity names match up to package names and whatnot. Could this be a bug? I honestly cannot find anything wrong.
Duplicate (+ working) code
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/logo3"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.ollygrov.bakerspride.Main"
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="com.ollygrov.bakerspride.Cal"
android:label="#string/title_activity_cal" >
</activity>
<activity
android:name="com.ollygrov.bakerspride.Breads"
android:label="#string/title_activity_breads" >
</activity>
</application>
Old (+ not working) code
<uses-sdk
android:minSdkVersion="14"
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.ollygrov.bakerspride.Main"
android:label="#string/app_title" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.ollygrov.bakerspride.Cal"
android:label="#string/title_activity_cal" >
</activity>
<activity
android:name="com.ollygrov.bakerspride.Breads"
android:label="#string/title_activity_breads" >
</activity>
<activity
android:name="com.ollygrov.bakerspride.Gal"
android:label="#string/title_activity_gal" >
</activity>
<activity
android:name="com.ollygrov.bakerspride.Tut"
android:label="#string/title_activity_tut" >
</activity>
<activity
android:name="com.ollygrov.bakerspride.Rec"
android:label="#string/title_activity_rec" >
</activity>
</application>
EDIT: I just copied and pasted the codes into the search bar on Chrome (changing the droid:icon and droid:label to fit) and they are exactly the same!! What?! Am I not allowed to have 6 activities or something?
Errors:
09-04 11:33:04.895: E/AndroidRuntime(717): FATAL EXCEPTION: main
09-04 11:33:04.895: E/AndroidRuntime(717): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ollygrov.bakerspride/com.ollygrov.bakerspride.Main}: java.lang.NullPointerException
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.ActivityThread.access$600(ActivityThread.java:130)
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
09-04 11:33:04.895: E/AndroidRuntime(717): at android.os.Handler.dispatchMessage(Handler.java:99)
09-04 11:33:04.895: E/AndroidRuntime(717): at android.os.Looper.loop(Looper.java:137)
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-04 11:33:04.895: E/AndroidRuntime(717): at java.lang.reflect.Method.invokeNative(Native Method)
09-04 11:33:04.895: E/AndroidRuntime(717): at java.lang.reflect.Method.invoke(Method.java:511)
09-04 11:33:04.895: E/AndroidRuntime(717): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-04 11:33:04.895: E/AndroidRuntime(717): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-04 11:33:04.895: E/AndroidRuntime(717): at dalvik.system.NativeStart.main(Native Method)
09-04 11:33:04.895: E/AndroidRuntime(717): Caused by: java.lang.NullPointerException
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.Activity.findViewById(Activity.java:1825)
09-04 11:33:04.895: E/AndroidRuntime(717): at com.ollygrov.bakerspride.Main.<init>(Main.java:19)
09-04 11:33:04.895: E/AndroidRuntime(717): at java.lang.Class.newInstanceImpl(Native Method)
09-04 11:33:04.895: E/AndroidRuntime(717): at java.lang.Class.newInstance(Class.java:1319)
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
09-04 11:33:04.895: E/AndroidRuntime(717): ... 11 more
09-04 11:34:58.665: E/Trace(765): error opening trace file: No such file or directory (2)
09-04 11:34:59.095: D/AndroidRuntime(765): Shutting down VM
09-04 11:34:59.095: W/dalvikvm(765): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
09-04 11:34:59.114: E/AndroidRuntime(765): FATAL EXCEPTION: main
09-04 11:34:59.114: E/AndroidRuntime(765): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ollygrov.bakerspride/com.ollygrov.bakerspride.Main}: java.lang.NullPointerException
09-04 11:34:59.114: E/AndroidRuntime(765): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
09-04 11:34:59.114: E/AndroidRuntime(765): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
09-04 11:34:59.114: E/AndroidRuntime(765): at android.app.ActivityThread.access$600(ActivityThread.java:130)
09-04 11:34:59.114: E/AndroidRuntime(765): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
09-04 11:34:59.114: E/AndroidRuntime(765): at android.os.Handler.dispatchMessage(Handler.java:99)
09-04 11:34:59.114: E/AndroidRuntime(765): at android.os.Looper.loop(Looper.java:137)
09-04 11:34:59.114: E/AndroidRuntime(765): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-04 11:34:59.114: E/AndroidRuntime(765): at java.lang.reflect.Method.invokeNative(Native Method)
09-04 11:34:59.114: E/AndroidRuntime(765): at java.lang.reflect.Method.invoke(Method.java:511)
09-04 11:34:59.114: E/AndroidRuntime(765): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-04 11:34:59.114: E/AndroidRuntime(765): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-04 11:34:59.114: E/AndroidRuntime(765): at dalvik.system.NativeStart.main(Native Method)
09-04 11:34:59.114: E/AndroidRuntime(765): Caused by: java.lang.NullPointerException
09-04 11:34:59.114: E/AndroidRuntime(765): at android.app.Activity.findViewById(Activity.java:1825)
09-04 11:34:59.114: E/AndroidRuntime(765): at com.ollygrov.bakerspride.Main.<init>(Main.java:19)
09-04 11:34:59.114: E/AndroidRuntime(765): at java.lang.Class.newInstanceImpl(Native Method)
09-04 11:34:59.114: E/AndroidRuntime(765): at java.lang.Class.newInstance(Class.java:1319)
09-04 11:34:59.114: E/AndroidRuntime(765): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
09-04 11:34:59.114: E/AndroidRuntime(765): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
The problem is your Main Constructor:
09-04 11:33:04.895: E/AndroidRuntime(717): Caused by: java.lang.NullPointerException
09-04 11:33:04.895: E/AndroidRuntime(717): at android.app.Activity.findViewById(Activity.java:1825)
09-04 11:33:04.895: E/AndroidRuntime(717): at com.ollygrov.bakerspride.Main.<init>(Main.java:19)
In line 19 of Main.java you are trying to call findViewById() which will obviously not work. It is way to early to call such code in the constructor.
My best guess is, that you need to move EVERYTHING from the cronstructor to onCreate() of the Activity.
Normally you don't need a custom constructor in Activities or Fragments.
I put the following code in my manifest.xml
<activity android:name="CPohonApp" android:configChanges="keyboardHidden|orientation"></activity>
and this is the code in my activity
#Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
but still the App crashes when I rotate.
Why does this happen?
I use Android 2.3.3 API 10
thank you
EDIT
this is my log cat
09-25 14:36:31.351: E/AndroidRuntime(334): FATAL EXCEPTION: main
09-25 14:36:31.351: E/AndroidRuntime(334): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.hdte.sawit/org.hdte.sawit.pohon.CPohonApp}: java.lang.NullPointerException
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:2832)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.ActivityThread.access$1600(ActivityThread.java:117)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.os.Handler.dispatchMessage(Handler.java:99)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.os.Looper.loop(Looper.java:123)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.ActivityThread.main(ActivityThread.java:3683)
09-25 14:36:31.351: E/AndroidRuntime(334): at java.lang.reflect.Method.invokeNative(Native Method)
09-25 14:36:31.351: E/AndroidRuntime(334): at java.lang.reflect.Method.invoke(Method.java:507)
09-25 14:36:31.351: E/AndroidRuntime(334): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-25 14:36:31.351: E/AndroidRuntime(334): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-25 14:36:31.351: E/AndroidRuntime(334): at dalvik.system.NativeStart.main(Native Method)
09-25 14:36:31.351: E/AndroidRuntime(334): Caused by: java.lang.NullPointerException
09-25 14:36:31.351: E/AndroidRuntime(334): at org.hdte.sawit.pohon.CPohonApp.createDialogSend(CPohonApp.java:277)
09-25 14:36:31.351: E/AndroidRuntime(334): at org.hdte.sawit.pohon.CPohonApp.onCreateDialog(CPohonApp.java:299)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.Activity.onCreateDialog(Activity.java:2482)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.Activity.createDialog(Activity.java:882)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.Activity.restoreManagedDialogs(Activity.java:871)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.Activity.performRestoreInstanceState(Activity.java:817)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1096)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1625)
09-25 14:36:31.351: E/AndroidRuntime(334): ... 12 more
You should you Dot(.) leading your activity Name.
<activity android:name=".CPohonApp" android:configChanges="keyboardHidden|orientation"></activity>
Or use full package name with your activity name when you declare it in android manifest file.
<activity android:name="yourpackagename.CPohonApp" android:configChanges="keyboardHidden|orientation"></activity>
Use in each Activity tag
<activity android:name=".example" android:configChanges="orientation|keyboardHidden"/>
add this code in manifest
android:configChanges="orientation|keyboardHidden|screenSize"
full code example
<activity
android:name=".your activity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name" >
</activity>
I have an app that deals with images, it works fine with some devices ex. HTC ONE X, and others dont ex. GALAXY NOTE, the list is big IDK the problem exatcly cuz it works in some, and it dont in others. also it doesnt work on the emulator the default one but a small one it does work
this is the logcat I get
08-15 18:30:39.070: I/dalvikvm-heap(334): Clamp target GC heap from 25.723MB to 24.000MB
08-15 18:30:39.090: D/dalvikvm(334): GC_FOR_MALLOC freed <1K, 51% free 2672K/5379K, external 19015K/19657K, paused 38ms
08-15 18:30:39.370: D/dalvikvm(334): GC_EXTERNAL_ALLOC freed <1K, 51% free 2672K/5379K, external 19015K/19657K, paused 45ms
08-15 18:30:39.400: E/dalvikvm-heap(334): 810000-byte external allocation too large for this process.
08-15 18:30:39.510: I/dalvikvm-heap(334): Clamp target GC heap from 25.724MB to 24.000MB
08-15 18:30:39.510: E/GraphicsJNI(334): VM won't let us allocate 810000 bytes
08-15 18:30:39.510: D/dalvikvm(334): GC_FOR_MALLOC freed 0K, 51% free 2672K/5379K, external 19015K/19657K, paused 36ms
08-15 18:30:39.532: D/AndroidRuntime(334): Shutting down VM
08-15 18:30:39.532: W/dalvikvm(334): threadid=1: thread exiting with uncaught exception (group=0x40015560)
08-15 18:30:39.600: E/AndroidRuntime(334): FATAL EXCEPTION: main
08-15 18:30:39.600: E/AndroidRuntime(334): java.lang.RuntimeException: Unable to start activity ComponentInfo{app.com.android.editor/app.com.android.editor.Option}: android.view.InflateException: Binary XML file line #317: Error inflating class <unknown>
08-15 18:30:39.600: E/AndroidRuntime(334): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.os.Handler.dispatchMessage(Handler.java:99)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.os.Looper.loop(Looper.java:123)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.app.ActivityThread.main(ActivityThread.java:3683)
08-15 18:30:39.600: E/AndroidRuntime(334): at java.lang.reflect.Method.invokeNative(Native Method)
08-15 18:30:39.600: E/AndroidRuntime(334): at java.lang.reflect.Method.invoke(Method.java:507)
08-15 18:30:39.600: E/AndroidRuntime(334): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-15 18:30:39.600: E/AndroidRuntime(334): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-15 18:30:39.600: E/AndroidRuntime(334): at dalvik.system.NativeStart.main(Native Method)
08-15 18:30:39.600: E/AndroidRuntime(334): Caused by: android.view.InflateException: Binary XML file line #317: Error inflating class <unknown>
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
08-15 18:30:39.600: E/AndroidRuntime(334): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
08-15 18:30:39.600: E/AndroidRuntime(334): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.app.Activity.setContentView(Activity.java:1657)
08-15 18:30:39.600: E/AndroidRuntime(334): at app.com.android.editor.Option.onCreate(Option.java:40)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
08-15 18:30:39.600: E/AndroidRuntime(334): ... 11 more
08-15 18:30:39.600: E/AndroidRuntime(334): Caused by: java.lang.reflect.InvocationTargetException
08-15 18:30:39.600: E/AndroidRuntime(334): at java.lang.reflect.Constructor.constructNative(Native Method)
08-15 18:30:39.600: E/AndroidRuntime(334): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
08-15 18:30:39.600: E/AndroidRuntime(334): ... 25 more
08-15 18:30:39.600: E/AndroidRuntime(334): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
08-15 18:30:39.600: E/AndroidRuntime(334): at android.graphics.Bitmap.nativeCreate(Native Method)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.graphics.Bitmap.createBitmap(Bitmap.java:444)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:349)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:498)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:473)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.content.res.Resources.loadDrawable(Resources.java:1709)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.View.<init>(View.java:1951)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.widget.TextView.<init>(TextView.java:344)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.widget.Button.<init>(Button.java:108)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.widget.Button.<init>(Button.java:104)
08-15 18:30:39.600: E/AndroidRuntime(334): ... 28 more
08-15 18:30:45.459: I/Process(334): Sending signal. PID: 334 SIG: 9
Heap sizes vary by device. It is perfectly reasonable that on devices where apps have large heap sizes you will encounter fewer problems than on devices where apps have smaller heap sizes. Your heap could be as low as 16MB, if you are supporting older/lower-resolution devices.
Most android has limited space. Usually 16MB. I highly suggest looking at your image size. Also use weak references where you can to make sure images are only using memory when accessed. (Weak references will force the garbage collected to clean them up quicker.)
And I don't know much about your app with just your logcat error list, but if you have multiple activities, kill the ones you don't need. Might seem like obvious advice, maybe not, but it will free up space.
As others stated, the heap size for an Application is limited. The minimum is 16MB and veries from device to device (it's a setting of the virtual machine).
Some suggestions what you could do:
You can load a smaller version of the image, if not needed in full resolution. Here is how to do it: http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html
Check if enough free memory is available; If memory gets low, you can just free images that are not directly needed right now and load them again, if they are needed.
Here is some code sniped for checking how much free memory is left:
long free = Runtime.getRuntime().freeMemory();
Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
that line says it all.
The bitmaps are hogging all the memory of some devices (devices that the VM stack limit is higher). You should look into better memory management for this application such as LruCache, decode bitmaps with lower quality, etc.
edit:
do not use WeakReference as some users might suggest.
check this question Does Android need to load a complete Bitmap from a file before sampling it down? and also this video http://www.youtube.com/watch?v=gbQb1PVjfqM
direct explanations/teachings/techniques from the creators of the platform and say to not use WeakReference.
I am fairly new to all this, so please bear with me! I have been trying to work out the style of my app today, and cant quite get it. I keep getting this error inflating class when I try to run the app on my AVD. I have no clue what it means, or how to fix it. I can tell its talking about my MainActivity, so Ill post the information for that as well.
07-29 21:41:35.751: D/dalvikvm(431): GC_EXTERNAL_ALLOC freed 53K, 53% free 2546K/5379K, external 1625K/2137K, paused 104ms
07-29 21:41:35.811: E/dalvikvm-heap(431): 31740000-byte external allocation too large for this process.
07-29 21:41:35.911: E/GraphicsJNI(431): VM won't let us allocate 31740000 bytes
07-29 21:41:35.911: D/dalvikvm(431): GC_FOR_MALLOC freed <1K, 53% free 2546K/5379K, external 1625K/2137K, paused 91ms
07-29 21:41:35.911: D/skia(431): --- decoder->decode returned false
07-29 21:41:35.971: D/AndroidRuntime(431): Shutting down VM
07-29 21:41:35.971: W/dalvikvm(431): threadid=1: thread exiting with uncaught exception (group=0x40015560)
07-29 21:41:36.021: E/AndroidRuntime(431): FATAL EXCEPTION: main
07-29 21:41:36.021: E/AndroidRuntime(431): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.madonk.louisiana.festivals/com.madonk.louisiana.festivals.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout
07-29 21:41:36.021: E/AndroidRuntime(431): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.os.Handler.dispatchMessage(Handler.java:99)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.os.Looper.loop(Looper.java:123)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.app.ActivityThread.main(ActivityThread.java:3683)
07-29 21:41:36.021: E/AndroidRuntime(431): at java.lang.reflect.Method.invokeNative(Native Method)
07-29 21:41:36.021: E/AndroidRuntime(431): at java.lang.reflect.Method.invoke(Method.java:507)
07-29 21:41:36.021: E/AndroidRuntime(431): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-29 21:41:36.021: E/AndroidRuntime(431): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-29 21:41:36.021: E/AndroidRuntime(431): at dalvik.system.NativeStart.main(Native Method)
07-29 21:41:36.021: E/AndroidRuntime(431): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
07-29 21:41:36.021: E/AndroidRuntime(431): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
07-29 21:41:36.021: E/AndroidRuntime(431): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.app.Activity.setContentView(Activity.java:1657)
07-29 21:41:36.021: E/AndroidRuntime(431): at com.madonk.louisiana.festivals.MainActivity.onCreate(MainActivity.java:16)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
07-29 21:41:36.021: E/AndroidRuntime(431): ... 11 more
07-29 21:41:36.021: E/AndroidRuntime(431): Caused by: java.lang.reflect.InvocationTargetException
07-29 21:41:36.021: E/AndroidRuntime(431): at java.lang.reflect.Constructor.constructNative(Native Method)
07-29 21:41:36.021: E/AndroidRuntime(431): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
07-29 21:41:36.021: E/AndroidRuntime(431): ... 21 more
07-29 21:41:36.021: E/AndroidRuntime(431): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
07-29 21:41:36.021: E/AndroidRuntime(431): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.content.res.Resources.loadDrawable(Resources.java:1709)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.View.<init>(View.java:1951)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.View.<init>(View.java:1899)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.ViewGroup.<init>(ViewGroup.java:286)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.widget.RelativeLayout.<init>(RelativeLayout.java:173)
07-29 21:41:36.021: E/AndroidRuntime(431): ... 24 more
07-29 21:42:43.762: I/Process(431): Sending signal. PID: 431 SIG: 9
Main_Activity.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/background" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginBottom="39dp"
android:text="#string/Definitive"
android:textColor="#style/AppTheme"
android:textSize="20dp"
android:textStyle="bold"
tools:context=".MainActivity" />
<Button
android:id="#+id/button_southwest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="136dp"
android:onClick="showOther"
android:text="#string/Southwest" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView1"
android:layout_centerHorizontal="true"
android:text="#string/Select_a_region"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#style/AppTheme"
android:textSize="20dp" />
</RelativeLayout>
Looks like your background drawable is too big, try to run app without background for RelativeLayout. Consider using color instead of drawable for your background.
You cannot use uppercase letters when naming resources in Android. Here you have #string/Definitive and #string/Select_a_region. Rename those and you should be fine. Hope this helps.