Hey guys,
Okay, so I am having a heck of a time here doing this app. I am
trying to create an app that has the webview up top and admob ads at
the bottom. I got the webView aspect to work then when I tried to ad
the admob I began getting errors. I first added the manifest and it
worked fine, but then when I tried to ad the admob xml to the main.xml
file I get a force close error before it opens.
I have many apps that the admob does fine, so I am pretty sure it is
just the combination of the 2
----------------------------------------------------------------------------------------------------------------------------------------------------
Now below is my error message in the ddms
----------------------------------------------------------------------------------------------------------------------------------------------------
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): FATAL EXCEPTION: main
08-27 09:58:40.682: ERROR/AndroidRuntime(7259):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.my app.TranslinkActivity}:
android.view.InflateException: Binary XML file line #9: Error
inflating class com.google.ads.AdView
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
1647)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
1663)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.app.ActivityThread.access$1500(ActivityThread.java:117)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.os.Handler.dispatchMessage(Handler.java:99)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.os.Looper.loop(Looper.java:130)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.app.ActivityThread.main(ActivityThread.java:3683)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
java.lang.reflect.Method.invokeNative(Native Method)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
java.lang.reflect.Method.invoke(Method.java:507)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
dalvik.system.NativeStart.main(Native Method)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): Caused by:
android.view.InflateException: Binary XML file line #9: Error
inflating class com.google.ads.AdView
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.view.LayoutInflater.inflate(LayoutInflater.java:408)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.view.LayoutInflater.inflate(LayoutInflater.java:276)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:
207)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.app.Activity.setContentView(Activity.java:1657)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
com.bettertranslinkapp.TranslinkActivity.onCreate(TranslinkActivity.java:
19)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
1611)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): ... 11 more
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): Caused by:
java.lang.ClassNotFoundException: com.google.ads.AdView in loader
dalvik.system.PathClassLoader[/data/app/com.my app.apk]
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
java.lang.ClassLoader.loadClass(ClassLoader.java:551)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
java.lang.ClassLoader.loadClass(ClassLoader.java:511)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.view.LayoutInflater.createView(LayoutInflater.java:471)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
08-27 09:58:40.682: ERROR/AndroidRuntime(7259): ... 20 more
--------------------------------------------------------------------------------------------------------------------------------------------------------
below is my activity
----------------------------------------------------------------------------------------------------------------------------------------------------
public class MyActivity extends Activity {
/** Called when the activity is first created. */
WebView mWebView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://mysite.com");
mWebView.setWebViewClient(new HelloWebViewClient());
}
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return true;
}
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {
mWebView.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
}
----------------------------------------------------------------------------------------------------------------------------
below is my xml
----------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.google.ads.AdView android:id="@+id/adView"
android:layout_height="wrap_content"
ads:adUnitId="myid"
ads:adSize="BANNER"
ads:loadAdOnCreate="true" android:layout_width="wrap_content"/>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
Thank for all the help guys
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en