I have an app on the market using admob and now I would like to update my app. When I test this new version I get a Fatal Exception caused by the admob.
04-06 15:09:04.123: E/AndroidRuntime(409): Caused by: android.view.InflateException: Binary XML file line #51: Error inflating class com.google.ads.AdView
04-06 15:09:04.123: E/AndroidRuntime(409): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView in loader dalvik.system.PathClassLoader[/data/app/com.kmbdev.purrkitty-2.apk]
Here is the xml file with line #51:
<com.google.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#id/bottom_border"
android:layout_toLeftOf="#id/right_border"
ads:adSize="BANNER"
ads:adUnitId="my id"
ads:loadAdOnCreate="true" />
I have not made any major changes from the original app that is published. I have only added a splash screen and some language strings files and changed the version to 1.2, the published app is version 1.1. I was wondering why this app will no longer run.
I have tried again, here is the log:
04-11 12:13:21.474: D/AndroidRuntime(282): Shutting down VM
04-11 12:13:21.474: W/dalvikvm(282): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
04-11 12:13:21.644: E/AndroidRuntime(282): FATAL EXCEPTION: main
04-11 12:13:21.644: E/AndroidRuntime(282): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.kmbdev.purrkitty/com.kmbdev.purrkitty.Cat1}: android.view.InflateException: Binary XML file line #52: Error inflating class com.google.ads.AdView
04-11 12:13:21.644: E/AndroidRuntime(282): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.os.Handler.dispatchMessage(Handler.java:99)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.os.Looper.loop(Looper.java:123)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-11 12:13:21.644: E/AndroidRuntime(282): at java.lang.reflect.Method.invokeNative(Native Method)
04-11 12:13:21.644: E/AndroidRuntime(282): at java.lang.reflect.Method.invoke(Method.java:521)
04-11 12:13:21.644: E/AndroidRuntime(282): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-11 12:13:21.644: E/AndroidRuntime(282): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-11 12:13:21.644: E/AndroidRuntime(282): at dalvik.system.NativeStart.main(Native Method)
04-11 12:13:21.644: E/AndroidRuntime(282): Caused by: android.view.InflateException: Binary XML file line #52: Error inflating class com.google.ads.AdView
04-11 12:13:21.644: E/AndroidRuntime(282): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-11 12:13:21.644: E/AndroidRuntime(282): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.app.Activity.setContentView(Activity.java:1647)
04-11 12:13:21.644: E/AndroidRuntime(282): at com.kmbdev.purrkitty.Cat1.onCreate(Cat1.java:25)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-11 12:13:21.644: E/AndroidRuntime(282): ... 11 more
04-11 12:13:21.644: E/AndroidRuntime(282): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView in loader dalvik.system.PathClassLoader[/data/app/com.kmbdev.purrkitty-2.apk]
04-11 12:13:21.644: E/AndroidRuntime(282): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
04-11 12:13:21.644: E/AndroidRuntime(282): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
04-11 12:13:21.644: E/AndroidRuntime(282): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
04-11 12:13:21.644: E/AndroidRuntime(282): ... 20 more
I've got the same issue and wasted more than 3 hours to figure it out. Finally, I found the way to make it work.
change sdk name from GoogleAdMobAdsSdk-6.0.0.jar to GoogleAdMobAdsSdk.jar
create "libs" folder under project, copy above sdk in the folder and link the library using Add External JARs.
if not worked, change import class name from com.google.ads.* to com.google.ads.AdRequest, comp.google.ads.AdView, and so on.
Are you sure the manifest has all the tags? (Those of admob). Also in the XML, you need to have a addl tag for xmlns right? Did you specify it?
Clean your project, and if you don't have activated the automatic build in Eclipse, make a manual build. It will work.
To fix that problem you just have to link the sdk .jar file in two ways. First, to add it to the libs folder (if you don't have one, create it) and then, right-click on .jar file, go to Build Path->Add to Build Path... Three days to that conclusion.
I fixed it by renaming the folder in which the jar file is kept from /lib to /libs.
Related
Hi guys I'm totally new to programming and need some help, and I hope one of you lovely people can help me:
When I run the AVD emulator I then click my button and I get an error saying "Unfortunately, Eventrecorder has stopped".
This is what my LogCat says:
04-11 22:08:10.415: D/dalvikvm(544): Not late-enabling CheckJNI (already on)
04-11 22:08:10.955: D/(544): Created
04-11 22:08:11.445: D/gralloc_goldfish(544): Emulator without GPU emulation detected.
04-11 22:08:19.615: D/AndroidRuntime(544): Shutting down VM
04-11 22:08:19.615: W/dalvikvm(544): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
04-11 22:08:19.655: E/AndroidRuntime(544): FATAL EXCEPTION: main
04-11 22:08:19.655: E/AndroidRuntime(544): java.lang.IllegalStateException: Could not execute method of the activity
04-11 22:08:19.655: E/AndroidRuntime(544): at android.view.View$1.onClick(View.java:3039)
04-11 22:08:19.655: E/AndroidRuntime(544): at android.view.View.performClick(View.java:3480)
04-11 22:08:19.655: E/AndroidRuntime(544): at android.view.View$PerformClick.run(View.java:13983)
04-11 22:08:19.655: E/AndroidRuntime(544): at android.os.Handler.handleCallback(Handler.java:605)
04-11 22:08:19.655: E/AndroidRuntime(544): at android.os.Handler.dispatchMessage(Handler.java:92)
04-11 22:08:19.655: E/AndroidRuntime(544): at android.os.Looper.loop(Looper.java:137)
04-11 22:08:19.655: E/AndroidRuntime(544): at android.app.ActivityThread.main(ActivityThread.java:4340)
04-11 22:08:19.655: E/AndroidRuntime(544): at java.lang.reflect.Method.invokeNative(Native Method)
04-11 22:08:19.655: E/AndroidRuntime(544): at java.lang.reflect.Method.invoke(Method.java:511)
04-11 22:08:19.655: E/AndroidRuntime(544): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-11 22:08:19.655: E/AndroidRuntime(544): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-11 22:08:19.655: E/AndroidRuntime(544): at dalvik.system.NativeStart.main(Native Method)
04-11 22:08:19.655: E/AndroidRuntime(544): Caused by: java.lang.reflect.InvocationTargetException
04-11 22:08:19.655: E/AndroidRuntime(544): at java.lang.reflect.Method.invokeNative(Native Method)
04-11 22:08:19.655: E/AndroidRuntime(544): at java.lang.reflect.Method.invoke(Method.java:511)
04-11 22:08:19.655: E/AndroidRuntime(544): at android.view.View$1.onClick(View.java:3034)
04-11 22:08:19.655: E/AndroidRuntime(544): ... 11 more
04-11 22:08:19.655: E/AndroidRuntime(544): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.eventrecorder/com.example.eventrecorder.NewEvent}; have you declared this activity in your AndroidManifest.xml?
04-11 22:08:19.655: E/AndroidRuntime(544): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1508)
04-11 22:08:19.655: E/AndroidRuntime(544): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
04-11 22:08:19.655: E/AndroidRuntime(544): at android.app.Activity.startActivityForResult(Activity.java:3190)
04-11 22:08:19.655: E/AndroidRuntime(544): at android.app.Activity.startActivity(Activity.java:3297)
04-11 22:08:19.655: E/AndroidRuntime(544): at com.example.eventrecorder.MainActivity.showAddForm(MainActivity.java:45)
04-11 22:08:19.655: E/AndroidRuntime(544): ... 14 more
Your AndroidManifest.xml file does not have an <activity> element with an android:name attribute of com.example.eventrecorder.NewEvent.
If NewEvent is supposed to be an activity, you need to add the associated <activity> element.
If NewEvent is not supposed to be an activity, go to line 45 of MainActivity, in your showAddForm() method, and fix the Intent that you are using with startActivity() to be one that points to an actual activity.
i'm getting this message when i run my application i don't know why i'm getting it could any one help me. here is the logcat.
java.lang.VerifyError: com.kosh.me.Smaller
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1429)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
at dalvik.system.NativeStart.main(Native Method)
This happens when the build library classes conflict with those at run-time. Try performing a Clean of your project followed by a build.
I am trying to write my first Android app, and I'm having trouble. I wrote a simple Java program to find the factors of a number provided by the user, and I'd like to port it over to Java. I have an XML file for the interface, which seemed to run OK until I added the first Java class. Now it won't run, and log.cat says that there's a null pointer exception. So far, I only have stubs, but it seems like it should run OK with what I've done to this point. I'm including the log.cat text, but I'm too new it this to make much sense out of it.
There may be more than one problem. After adding the Java file I began to get run-time errors right away, but I don't think they were null pointer exceptions. I think that started when I made changes to fix what was already causing problems.
Any help is appreciated.
Here is the Java file:
import android.app.Activity; <br>
import android.os.Bundle; <br>
import android.widget.Button; <br>
import android.widget.EditText; <br>
import android.widget.TextView; <br>
public class AndroidFactoringActivity extends Activity {
// Instance Variables
EditText userNumber;
Button factorButton;
TextView resultsField;
int factorResults;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
factorButton = (Button) findViewById(R.id.factorButton);
userNumber = (EditText) findViewById(R.id.userNumber);
factorResults = 1;
resultsField.setText(String.valueOf(factorResults));
}
}
Here is 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:orientation="vertical" >
<TextView
android:id="#+id/askField"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/ask"
android:textSize="24dp" />
<EditText
android:id="#+id/userNumber"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number" >
<requestFocus />
</EditText>
<Button
android:id="#+id/factorButton"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/click" />
<TextView
android:id="#+id/resultsField"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/tell"
android:textSize="24dp" />
</LinearLayout>
Here are the log.cat results:
03-31 23:58:53.579: D/AndroidRuntime(2804): Shutting down VM
03-31 23:58:53.589: W/dalvikvm(2804): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
03-31 23:58:53.589: E/AndroidRuntime(2804): Uncaught handler: thread main exiting due to uncaught exception
03-31 23:58:53.650: E/AndroidRuntime(2804): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.dave_b.factoring/net.dave_b.factoring.AndroidFactoringActivity}: java.lang.NullPointerException
03-31 23:58:53.650: E/AndroidRuntime(2804): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
03-31 23:58:53.650: E/AndroidRuntime(2804): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
03-31 23:58:53.650: E/AndroidRuntime(2804): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
03-31 23:58:53.650: E/AndroidRuntime(2804): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
03-31 23:58:53.650: E/AndroidRuntime(2804): at android.os.Handler.dispatchMessage(Handler.java:99)
03-31 23:58:53.650: E/AndroidRuntime(2804): at android.os.Looper.loop(Looper.java:123)
03-31 23:58:53.650: E/AndroidRuntime(2804): at android.app.ActivityThread.main(ActivityThread.java:4363)
03-31 23:58:53.650: E/AndroidRuntime(2804): at java.lang.reflect.Method.invokeNative(Native Method)
03-31 23:58:53.650: E/AndroidRuntime(2804): at java.lang.reflect.Method.invoke(Method.java:521)
03-31 23:58:53.650: E/AndroidRuntime(2804): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-31 23:58:53.650: E/AndroidRuntime(2804): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-31 23:58:53.650: E/AndroidRuntime(2804): at dalvik.system.NativeStart.main(Native Method)
03-31 23:58:53.650: E/AndroidRuntime(2804): Caused by: java.lang.NullPointerException
03-31 23:58:53.650: E/AndroidRuntime(2804): at net.dave_b.factoring.AndroidFactoringActivity.onCreate(AndroidFactoringActivity.java:26)
03-31 23:58:53.650: E/AndroidRuntime(2804): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-31 23:58:53.650: E/AndroidRuntime(2804): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
03-31 23:58:53.650: E/AndroidRuntime(2804): ... 11 more
03-31 23:58:53.679: I/dalvikvm(2804): threadid=7: reacting to signal 3
03-31 23:58:53.679: E/dalvikvm(2804): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
03-31 23:59:57.629: I/Process(2804): Sending signal. PID: 2804 SIG: 9
04-01 00:07:36.129: D/AndroidRuntime(3040): Shutting down VM
04-01 00:07:36.129: W/dalvikvm(3040): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
04-01 00:07:36.139: E/AndroidRuntime(3040): Uncaught handler: thread main exiting due to uncaught exception
04-01 00:07:36.159: E/AndroidRuntime(3040): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.dave_b.factoring/net.dave_b.factoring.AndroidFactoringActivity}: java.lang.NullPointerException
04-01 00:07:36.159: E/AndroidRuntime(3040): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
04-01 00:07:36.159: E/AndroidRuntime(3040): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
04-01 00:07:36.159: E/AndroidRuntime(3040): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
04-01 00:07:36.159: E/AndroidRuntime(3040): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
04-01 00:07:36.159: E/AndroidRuntime(3040): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 00:07:36.159: E/AndroidRuntime(3040): at android.os.Looper.loop(Looper.java:123)
04-01 00:07:36.159: E/AndroidRuntime(3040): at android.app.ActivityThread.main(ActivityThread.java:4363)
04-01 00:07:36.159: E/AndroidRuntime(3040): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 00:07:36.159: E/AndroidRuntime(3040): at java.lang.reflect.Method.invoke(Method.java:521)
04-01 00:07:36.159: E/AndroidRuntime(3040): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
04-01 00:07:36.159: E/AndroidRuntime(3040): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
04-01 00:07:36.159: E/AndroidRuntime(3040): at dalvik.system.NativeStart.main(Native Method)
04-01 00:07:36.159: E/AndroidRuntime(3040): Caused by: java.lang.NullPointerException
04-01 00:07:36.159: E/AndroidRuntime(3040): at net.dave_b.factoring.AndroidFactoringActivity.onCreate(AndroidFactoringActivity.java:26)
04-01 00:07:36.159: E/AndroidRuntime(3040): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-01 00:07:36.159: E/AndroidRuntime(3040): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
04-01 00:07:36.159: E/AndroidRuntime(3040): ... 11 more
04-01 00:07:36.199: I/dalvikvm(3040): threadid=7: reacting to signal 3
04-01 00:07:36.199: E/dalvikvm(3040): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
04-01 00:07:40.329: I/Process(3040): Sending signal. PID: 3040 SIG: 9
resultsField.setText(String.valueOf(factorResults));
resultsField is null and you are trying to set value on null.
resultsField= (TextView ) findViewById(R.id.userNumber);
Get textview instance before setting value, otherwise resultsField will be null and all operations on null reference results in NullPointerException.
You got a null pointer because you didnt intialise the variable resultsField (you just declared it) .
As you used
userNumber = (EditText) findViewById(R.id.userNumber);
you must even initialise the reference resultsField.
This can be done using
resultsField= (TextView ) findViewById(R.id.resultsField);
in the onCreate() after the statement setContentView()
You need to initialize the userNumer and resultsFiled as follows
userNumber = (EditText) findViewById(R.id.userNumber);
resultsField= (TextView ) findViewById(R.id.resultsField);
i got following strange exception on only andorid simulator 2.0
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.markupartist.android.example.pulltorefresh/com.markupartist.android.example.pulltorefresh.PullToRefreshActivity}: android.view.InflateException: Binary XML file line #10: Error inflating class com.markupartist.android.widget.PullToRefreshListView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class com.markupartist.android.widget.PullToRefreshListView
at android.view.LayoutInflater.createView(LayoutInflater.java:513)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
at android.app.Activity.setContentView(Activity.java:1647)
at com.markupartist.android.example.pulltorefresh.PullToRefreshActivity.onCreate(PullToRefresh Activity.java:21)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at com.markupartist.android.widget.PullToRefreshListView. (PullToRefreshListView.java:54)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:500)
... 21 more
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030002
at android.content.res.Resources.getValue(Resources.java:892)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:1869)
at android.content.res.Resources.getLayout(Resources.java:731)
at android.view.LayoutInflater.inflate(LayoutInflater.java:318)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.markupartist.android.widget.PullToRefreshListView.init(PullToRefreshListView.java:80)
... 25 more
when i tested on andorid 1.6 , 2.01,2.1,2.2,2.3 ,4.0 it works completely,
is this a simulator bug of 2.0
please give me some information about this
Thanks
i have a very simple setup for my app in order to test adwhirl
import android.app.Activity;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.adwhirl.AdWhirlLayout;
public class testads extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.testads);
LinearLayout layout = (LinearLayout) findViewById(R.id.layout_main);
AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this, "my_ADWHIRLSDKCODE");
RelativeLayout.LayoutParams adWhirlLayoutParams =
new RelativeLayout.LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT);
layout.addView(adWhirlLayout, adWhirlLayoutParams);
layout.invalidate();
}
}
and the layout file is as follows
<?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:id="#+id/layout_main"
>
<TextView android:text="TextView" android:id="#+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<AdWhirlLayout android:id="#+id/adwhirl_layout"/>
</LinearLayout>
When i run it, the app crashes... This should be so simple, what am i doing wrong?
edit: i am sorry i did not include the log error before... here it is
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): FATAL EXCEPTION: main
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.vicvic.android/com.vicvic.android.testads}: android.view.InflateException: Binary XML file line #9: Error inflating class AdWhirlLayout
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.os.Handler.dispatchMessage(Handler.java:99)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.os.Looper.loop(Looper.java:123)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at java.lang.reflect.Method.invokeNative(Native Method)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at java.lang.reflect.Method.invoke(Method.java:521)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at dalvik.system.NativeStart.main(Native Method)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class AdWhirlLayout
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.app.Activity.setContentView(Activity.java:1647)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at com.vicvic.android.testads.onCreate(testads.java:18)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): ... 11 more
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): Caused by: java.lang.ClassNotFoundException: android.view.AdWhirlLayout in loader dalvik.system.PathClassLoader[/data/app/com.vicvic.android-2.apk]
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:544)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
04-11 17:21:36.215: ERROR/AndroidRuntime(2084): ... 20 more
04-11 17:21:36.375: WARN/ActivityManager(66): Force finishing activity com.vicvic.android/.testads
04-11 17:21:36.895: WARN/ActivityManager(66): Activity pause timeout for HistoryRecord{44f65b98 com.vicvic.android/.testads}
04-11 17:21:42.635: DEBUG/dalvikvm(185): GC_EXPLICIT freed 149 objects / 10872 bytes in 86ms
04-11 17:21:47.308: WARN/ActivityManager(66): Activity destroy timeout for HistoryRecord{44f65b98 com.vicvic.android/.testads}
04-11 17:21:47.735: DEBUG/dalvikvm(267): GC_EXPLICIT freed 31 objects / 1400 bytes in 178ms
04-11 17:22:29.135: DEBUG/SntpClient(66): request time failed: java.net.SocketException: Address family not supported by protocol
Without an error message it's just guessing.
Try something like
<com.adwhirl.AdWhirlLayout> in your XML using the package name of the AdWhirlLayout-Class
Without the error from your logcat we can only guess:
You have defined AdWhirlLayout in your xml but you create a new one in your onCreate. I guess you should also use findViewById for your adwhirllayout and you shouldn't add it to your layout_main, because it is already there.
Thats just a guess because you didn't provide an error message...
edit: You should decide: Do you layout in xml (than follow what #Hache has said) or do it in onCreate. Don't try to mix both ways, especially not adding the same view twice (once in xml, once in onCreate)