0

I have an App that used AdWhirl. Since Admob is doing the same task in a more udated way, I want to switch from AdWhirl to Admob. I have changed my layout/main.xml and now the grahpical layout crashes. When I run the app on the phone it gets installed, but at the launching process it goes to an ANR and shuts down.

In my manifest.xml I have this:

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    android:versionName="1.0" android:versionCode="1" package="com.recetas.two">
    <uses-sdk android:minSdkVersion="4"/>


    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>

    <supports-screens android:largeScreens="true" android:anyDensity="true" 
        android:smallScreens="true" android:resizeable="true" 
        android:normalScreens="true"></supports-screens>

   <application android:label="@string/app_name" android:icon="@drawable/cauldron">
        <activity android:label="@string/app_name" android:name=".RecetasTwo">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.mobfox.sdk.InAppWebView"></activity> 
        <meta-data android:name="ADWHIRL_KEY" android:value="*********************"/> 

        <activity android:name="com.google.ads.AdActivity"
               android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

        <activity android:name=".primerareceta"
                  android:label="@string/app_name"/>
        <activity android:name=".segundareceta"

my main.xml file has all of this inside

    <?xml version="1.0" encoding="utf-8"?>
<!-- This file is /res/layout/main.xml -->

<RelativeLayout
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.adwhirl.AdWhirlLayout 
    android:id="@+id/adwhirl_layout" 
    android:layout_width="fill_parent"
    android:layout_alignParentBottom="true"
    android:layout_height="53dp">
</com.adwhirl.AdWhirlLayout> 
-->

<com.google.ads.AdView android:id="@+id/adView"
                         xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:layout_gravity="bottom" 
                         ads:adUnitId="a14ea442d20988d"
                         ads:adSize="BANNER"
                         ads:testing="false"
                         ads:loadAdOnCreate="true"/>

<!-- 
<com.mobfox.sdk.MobFoxView
            android:id="@+id/mobFoxView"
            android:layout_width="fill_parent"
            android:layout_height="50dp"
            publisheID="f9205cd278ce092837a01cc4ca4af6a"/>
 -->            

<ScrollView 
android:id="@+id/scroll" 
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/adView">

<LinearLayout 
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<Button android:id="@+id/primerarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_blue"
android:text="@string/primerareceta"
android:textColor="#ffffff"/>

<Button android:id="@+id/segundarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_yellow"
android:text="@string/segundareceta"
android:textColor="#ff0000"/>

<Button android:background="@drawable/custom_button_blue" 
android:id="@+id/tercerarecetaPlayerBtn"
android:textColor="#ffffff"
android:layout_height="wrap_content"
android:layout_width="fill_parent" 
android:text="@string/tercerareceta"/>

<Button android:id="@+id/cuartarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_yellow"
android:text="@string/cuartareceta"
android:textColor="#ff0000"/>

<Button android:id="@+id/quintarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_blue"
android:text="@string/quintareceta"
android:textColor="#ffffff"/>

<Button android:id="@+id/sextarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_yellow"
android:text="@string/sextareceta"
android:textColor="#ff0000"/>

<Button android:id="@+id/septimarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_blue"
android:text="@string/septimareceta"
android:textColor="#ffffff"/>

<Button android:id="@+id/octavarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_yellow"
android:text="@string/octavareceta"
android:textColor="#ff0000"/>

<Button android:id="@+id/novenarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_blue"
android:text="@string/novenareceta"
android:textColor="#ffffff"/>

<Button android:id="@+id/decimarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_yellow"
android:text="@string/decimareceta"
android:textColor="#ff0000"/>

<Button android:id="@+id/undecimarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_blue"
android:text="@string/undecimareceta"
android:textColor="#ffffff"/>

<Button android:id="@+id/duodecimarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_yellow"
android:text="@string/duodecimareceta"
android:textColor="#ff0000"/>

<Button android:id="@+id/decimotercerarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_blue"
android:text="@string/decimotercerareceta"
android:textColor="#ffffff"/>

<Button android:id="@+id/decimocuartarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_yellow"
android:text="@string/decimocuartareceta"
android:textColor="#ff0000"/>

<Button android:id="@+id/decimoquintarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_blue"
android:text="@string/decimoquintareceta"
android:textColor="#ffffff"/>

<Button android:id="@+id/decimosextarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_yellow"
android:text="@string/decimosextareceta"
android:textColor="#ff0000"/>

<Button android:id="@+id/decimoseptimarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_blue"
android:text="@string/decimoseptimareceta"
android:textColor="#ffffff"/>


<Button android:id="@+id/decimoctavarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_yellow"
android:text="@string/decimoctavareceta"
android:textColor="#ff0000"/>

<Button android:id="@+id/decimonovenarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_blue"
android:text="@string/decimonovenareceta"
android:textColor="#ffffff"/>

<Button android:id="@+id/vigesimarecetaPlayerBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_button_yellow"
android:text="@string/vigesimareceta"
android:textColor="#ff0000"/>

</LinearLayout>
</ScrollView>
</RelativeLayout>

All of this is used in my main java file in this way:

    package com.recetas.two;

//import android.R.layout;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.speech.tts.TextToSpeech.OnInitListener;
//import android.text.Layout;
import android.text.SpannableString;
import android.text.util.Linkify;
import android.net.Uri;
import android.os.Bundle;
//import android.view.Gravity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
//import android.view.ViewGroup;
//import android.view.ViewGroup;
//import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.LinearLayout;
//import android.widget.LinearLayout;
//import android.widget.RelativeLayout;
import android.widget.TextView;
//import com.adwhirl.AdWhirlLayout;
//import com.adwhirl.AdWhirlLayout.AdWhirlInterface;
//import com.adwhirl.AdWhirlManager;
//import com.adwhirl.AdWhirlTargeting;
import com.flurry.android.FlurryAgent;
import com.google.ads.*;

public class RecetasTwo extends Activity implements OnInitListener {

private AdView adView;  
//DefiniciÛn del men˙ en menu.xml
@Override
public boolean onCreateOptionsMenu(Menu menu){

    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu, menu);
    return true;
    }

//Lo que hace cada opciÛn del menu
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    switch (item.getItemId()) {
    case R.id.Otras_apps:
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/developer?id=Pedro+Santangelo")));
        return true;
    case R.id.Salir:
        FlurryAgent.onEndSession(this);
        this.finish();
        return true;
    case R.id.Acerca:
        AlertDialog builder;
            try {
                builder = AboutDialogBuilder.create(this);
                builder.show();
            } catch (NameNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
    default:
        return super.onOptionsItemSelected(item);
    }
}

//para cerrar la sesiÛn de Flurry
public void onStop()
{
   super.onStop();
   FlurryAgent.onEndSession(this);
}

@Override
public void onDestroy() {
  if (adView != null) {
    adView.destroy();
  }
  super.onDestroy();
}

//Definicion de la interfaz de usuario
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

adView = new AdView(this, AdSize.BANNER, "a150b14b7d531ff");    

// Lookup your LinearLayout assuming it's been given
// the attribute android:id="@+id/mainLayout"
LinearLayout layout = (LinearLayout)findViewById(R.id.scroll);

// Add the adView to it
layout.addView(adView);

// Initiate a generic request to load it with an ad
adView.loadAd(new AdRequest());

/* La manera de invocar AdWhirl ha cambiado
// Hay que quitar los dos comentarios para habilitar AdWhirl    
AdWhirlLayout mAdWhirlLayout = (AdWhirlLayout) findViewById(R.id.adwhirl_layout); 
//This is an important step in order to use the custom event created. 
mAdWhirlLayout.adWhirlInterface=(new CustomEvents(mAdWhirlLayout, this, getApplicationContext())); 
*/
/*
AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this, "01dffd1ea64f44dca764f38c3ead174c");
RelativeLayout.LayoutParams adWhirlLayoutParams = new RelativeLayout.LayoutParams(320, 52);
Layout.addView(adWhirlLayout, adWhirlLayoutParams);
*/  
/*
    //-- 
    AdWhirlManager.setConfigExpireTimeout(1000 * 60 * 5);

       AdWhirlTargeting.setAge(23);
       AdWhirlTargeting.setGender(AdWhirlTargeting.Gender.MALE);
       AdWhirlTargeting.setKeywords("online games gaming");
       AdWhirlTargeting.setPostalCode("94123");
       AdWhirlTargeting.setTestMode(false);

       AdWhirlLayout adWhirlLayout = (AdWhirlLayout)findViewById(R.id.adwhirl_layout);

       TextView textView = new TextView(this);
       RelativeLayout.LayoutParams layoutParams = new
         RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                                     LayoutParams.WRAP_CONTENT);
       int diWidth = 320;
       int diHeight = 52;
       int density = (int) getResources().getDisplayMetrics().density;

       adWhirlLayout.setAdWhirlInterface((AdWhirlInterface) this);
       adWhirlLayout.setMaxWidth((int)(diWidth * density));
       adWhirlLayout.setMaxHeight((int)(diHeight * density));

       layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
       textView.setText("Below AdWhirlLayout");

       LinearLayout layout = (LinearLayout)findViewById(R.id.adwhirl_layout);

       layout.setGravity(Gravity.CENTER_HORIZONTAL);
       layout.addView(adWhirlLayout, layoutParams);
       layout.addView(textView, layoutParams);
       layout.invalidate();





    class HelloAdWhirl extends Activity implements AdWhirlInterface {
         public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.main);

           AdWhirlManager.setConfigExpireTimeout(1000 * 60 * 5);

           AdWhirlTargeting.setAge(23);
           AdWhirlTargeting.setGender(AdWhirlTargeting.Gender.MALE);
           AdWhirlTargeting.setKeywords("online games gaming");
           AdWhirlTargeting.setPostalCode("94123");
           AdWhirlTargeting.setTestMode(false);

           AdWhirlLayout adWhirlLayout = (AdWhirlLayout)findViewById(R.id.adwhirl_layout);

           TextView textView = new TextView(this);
           RelativeLayout.LayoutParams layoutParams = new
             RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                                         LayoutParams.WRAP_CONTENT);
           int diWidth = 320;
           int diHeight = 52;
           int density = (int) getResources().getDisplayMetrics().density;

           adWhirlLayout.setAdWhirlInterface(this);
           adWhirlLayout.setMaxWidth((int)(diWidth * density));
           adWhirlLayout.setMaxHeight((int)(diHeight * density));

           layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
           textView.setText("Below AdWhirlLayout");

       LinearLayout layout = (LinearLayout)findViewById(R.id.adwhirl_layout);

           layout.setGravity(Gravity.CENTER_HORIZONTAL);
           layout.addView(adWhirlLayout, layoutParams);
           layout.addView(textView, layoutParams);
           layout.invalidate();
         }

        public void adWhirlGeneric() {
            // TODO Auto-generated method stub

        }
        }   
*/      
// -- empiezan las recetas  
Button primerarecetaPlayerBtn = (Button)findViewById(R.id.primerarecetaPlayerBtn);
Button segundarecetaPlayerBtn = (Button)findViewById(R.id.segundarecetaPlayerBtn);

The stack dump after the error is this one:

java.lang.NullPointerException: package name is null
at android.content.ComponentName.<init>(ComponentName.java:46)
at com.adwhirl.AdWhirlLayout.getAdWhirlKey(AdWhirlLayout.java:119)
at com.adwhirl.AdWhirlLayout.<init>(AdWhirlLayout.java:107)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:413)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:170)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:135)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:746)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:718)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:372)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:385)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:332)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:440)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1545)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1302)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.changed(GraphicalEditorPart.java:718)
at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationChooser.syncRenderState(ConfigurationChooser.java:1721)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:1052)
at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegatePageChange(LayoutEditorDelegate.java:683)
at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.pageChange(CommonXmlEditor.java:360)
at org.eclipse.ui.part.MultiPageEditorPart$2.widgetSelected(MultiPageEditorPart.java:292)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4134)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1458)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1481)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1271)
at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3023)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1730)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:270)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4134)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1458)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1481)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1271)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3980)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3619)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1029)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:923)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)

The problem happens at:

03-17 17:00:24.263: E/AndroidRuntime(10705): at com.recetas.two.RecetasTwo.onCreate(RecetasTwo.java:101)

The dump of DDMS says:

    03-17 16:40:07.674: W/ICU(26150): Missing ICU latn symbols system value: U_MISSING_RESOURCE_ERROR
03-17 16:40:07.956: D/(26150): bjarch:Create hashTable
03-17 16:40:07.988: I/dalvikvm(26150): threadid=3: reacting to signal 3
03-17 16:40:08.280: I/dalvikvm(26150): Wrote stack traces to '/data/anr/traces.txt'
03-17 16:40:08.560: I/dalvikvm(26150): threadid=3: reacting to signal 3
03-17 16:40:08.710: I/dalvikvm(26150): Wrote stack traces to '/data/anr/traces.txt'
03-17 16:40:08.729: I/Ads(26150): To get test ads on this device, call adRequest.addTestDevice("79DA5934F2C7B69BE58A3F8A1D6FA419");
03-17 16:40:08.974: I/dalvikvm(26150): threadid=3: reacting to signal 3
03-17 16:40:09.037: I/dalvikvm(26150): Wrote stack traces to '/data/anr/traces.txt'
03-17 16:40:09.076: D/AndroidRuntime(26150): Shutting down VM
03-17 16:40:09.076: W/dalvikvm(26150): threadid=1: thread exiting with uncaught exception (group=0x41a0e6f0)
03-17 16:40:09.078: E/AndroidRuntime(26150): FATAL EXCEPTION: main
03-17 16:40:09.078: E/AndroidRuntime(26150): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.recetas.two/com.recetas.two.RecetasTwo}: java.lang.ClassCastException: android.widget.ScrollView cannot be cast to android.widget.LinearLayout
03-17 16:40:09.078: E/AndroidRuntime(26150):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2049)
03-17 16:40:09.078: E/AndroidRuntime(26150):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2083)
03-17 16:40:09.078: E/AndroidRuntime(26150):    at android.app.ActivityThread.access$600(ActivityThread.java:134)
03-17 16:40:09.078: E/AndroidRuntime(26150):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1233)
03-17 16:40:09.078: E/AndroidRuntime(26150):    at android.os.Handler.dispatchMessage(Handler.java:99)
03-17 16:40:09.078: E/AndroidRuntime(26150):    at android.os.Looper.loop(Looper.java:137)
03-17 16:40:09.078: E/AndroidRuntime(26150):    at android.app.ActivityThread.main(ActivityThread.java:4697)
03-17 16:40:09.078: E/AndroidRuntime(26150):    at java.lang.reflect.Method.invokeNative(Native Method)
03-17 16:40:09.078: E/AndroidRuntime(26150):    at java.lang.reflect.Method.invoke(Method.java:511)
03-17 16:40:09.078: E/AndroidRuntime(26150):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
03-17 16:40:09.078: E/AndroidRuntime(26150):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
03-17 16:40:09.078: E/AndroidRuntime(26150):    at dalvik.system.NativeStart.main(Native Method)
03-17 16:40:09.078: E/AndroidRuntime(26150): Caused by: java.lang.ClassCastException: android.widget.ScrollView cannot be cast to android.widget.LinearLayout
03-17 16:40:09.078: E/AndroidRuntime(26150):    at com.recetas.two.RecetasTwo.onCreate(RecetasTwo.java:101)
03-17 16:40:09.078: E/AndroidRuntime(26150):    at android.app.Activity.performCreate(Activity.java:4542)
03-17 16:40:09.078: E/AndroidRuntime(26150):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
03-17 16:40:09.078: E/AndroidRuntime(26150):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2013)
03-17 16:40:09.078: E/AndroidRuntime(26150):    ... 11 more
03-17 16:40:09.171: I/Ads(26150): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_getSdkConstants();AFMA_buildAdURL({"kw":[],"preqs":0,"session_id":"8406145823976734783","u_sd":1.5,"seq_num":"1","slotname":"a14ea442d20988d","u_w":360,"msid":"com.recetas.two","js":"afma-sdk-a-v6.2.1","mv":"15.android","isu":"79DA5934F2C7B69BE58A3F8A1D6FA419","cipa":0,"bas_off":0,"format":"320x50_mb","oar":0,"net":"ed","app_name":"1.android.com.recetas.two","hl":"en","ad_pos":{"height":0,"visible":0,"y":0,"x":0,"width":0},"gnt":15,"u_h":592,"carrier":"21401","bas_on":0,"ptime":0,"u_audio":3});</script></head><body></body></html>
03-17 16:40:09.560: I/dalvikvm(26150): threadid=3: reacting to signal 3
03-17 16:40:09.706: I/dalvikvm(26150): Wrote stack traces to '/data/anr/traces.txt'
03-17 16:40:09.989: I/dalvikvm(26150): threadid=3: reacting to signal 3
03-17 16:40:10.062: I/dalvikvm(26150): Wrote stack traces to '/data/anr/traces.txt'
03-17 16:40:10.083: D/CallStack(26150): #00  pc 002d637a  /system/lib/libwebcore.so
03-17 16:40:10.083: D/CallStack(26150): #01  pc 00557e76  /system/lib/libwebcore.so
03-17 16:40:10.083: D/CallStack(26150): #02  pc 0002d200  /system/lib/libdvm.so
03-17 16:40:10.474: I/dalvikvm(26150): threadid=3: reacting to signal 3
03-17 16:40:10.537: I/dalvikvm(26150): Wrote stack traces to '/data/anr/traces.txt'
03-17 16:40:10.976: I/dalvikvm(26150): threadid=3: reacting to signal 3
03-17 16:40:11.023: I/dalvikvm(26150): Wrote stack traces to '/data/anr/traces.txt'
03-17 16:40:11.232: V/webcore(26150): SET_BACKGROUND_COLOR arg1=0 arg2=0 obj=null
03-17 16:40:11.232: V/webcore(26150): SET_BACKGROUND_COLOR arg1=0 arg2=0 obj=null
03-17 16:40:11.232: V/webcore(26150): SET_BACKGROUND_COLOR arg1=0 arg2=0 obj=null
03-17 16:40:11.476: I/dalvikvm(26150): threadid=3: reacting to signal 3
03-17 16:40:11.489: I/dalvikvm(26150): Wrote stack traces to '/data/anr/traces.txt'
03-17 16:40:11.976: I/dalvikvm(26150): threadid=3: reacting to signal 3
03-17 16:40:11.981: I/dalvikvm(26150): Wrote stack traces to '/data/anr/traces.txt'
03-17 16:40:12.477: I/dalvikvm(26150): threadid=3: reacting to signal 3
03-17 16:40:12.506: I/dalvikvm(26150): Wrote stack traces to '/data/anr/traces.txt'
03-17 16:40:12.985: I/dalvikvm(26150): threadid=3: reacting to signal 3

I can't access to /data/anr/traces.txt because my device is not rooted... at least not today.

On Screen appears a message that says "Unfortunately com.recetas.two has stopped working"

I have tried everything I have googled, but no way :-( Could you help me with this issue, please?

Thanks in advance for your help Pedro

Pedro Santangelo
  • 143
  • 2
  • 13

1 Answers1

0

You have two problems:

  1. According to logcat, you're trying to cast a ScrollView to a LinearLayout. You'll want to fix LinearLayout layout = (LinearLayout)findViewById(R.id.scroll); to be ScrollView layout = (ScrollView)findViewById(R.id.scroll);
  2. If you no longer have an AdWhirlLayout in your XML file, make sure you aren't referencing AdWhirl at all in your code. It's hard to tell if you actually have everything commented out.
Eric Leichtenschlag
  • 8,881
  • 1
  • 28
  • 28