Unable to start activity ComponentInfo: java.lang.NullPointerException -ADMOB

81 views
Skip to first unread message

codemobil...@gmail.com

unread,
May 26, 2014, 9:41:41 AM5/26/14
to google-adm...@googlegroups.com
I did everything like the tutorial tells the AdMob site, put the layout in XML, imported the path Google Play Sevices and added the lines of code from the tutorial, my application compiles, but no longer opens on your smartphone.

Follows the code.



Classe

package your.CalculoHE.namespace;


import org.apache.cordova.DroidGap;
import com.google.android.gms.ads.*;


import android.os.Bundle;

public class CalculoHoraExtraActivity extends DroidGap {    

   
/** Called when the activity is first created. */
   
@Override
   
public void onCreate(Bundle savedInstanceState) {
       
super.onCreate(savedInstanceState);
       
super.setContentView(R.layout.main);
       
super.setIntegerProperty("splashscreen", R.drawable.sobreaviso);
       
super.loadUrl("file:///android_asset/www/index.html", 3000);

       
// Consultar o AdView como um recurso e carregar uma solicitação.
       
AdView adView = (AdView)this.findViewById(R.id.adView);
       
AdRequest adRequest = new AdRequest.Builder().build();
        adView
.loadAd(adRequest);
       
   
}    
   
}    



main.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/res-auto"
             
android:orientation="vertical"
             
android:layout_width="match_parent"
             
android:layout_height="match_parent">
 
<com.google.android.gms.ads.AdView android:id="@+id/adView"
                         
android:layout_width="wrap_content"
                         
android:layout_height="wrap_content"
                         
ads:adUnitId="ca-app-pub-6560993155721972/3382486845"
                         
ads:adSize="BANNER"/>

<TextView
   
android:layout_width="fill_parent"
   
android:layout_height="wrap_content"
   
android:text="Hora extras"
   
/>
</LinearLayout>


manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   
package="your.CalculoHE.namespace"
   
android:versionCode="4"
   
android:versionName="1.2" >

   
<uses-sdk android:minSdkVersion="9" />

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

   
<application android:icon="@drawable/ic_launcher"
       
android:label="@string/app_name" >
       
       
<meta-data android:name="com.google.android.gms.version"
               
android:value="@integer/google_play_services_version"/>

       
       
<activity android:configChanges="orientation|keyboardHidden" android:name=".CalculoHoraExtraActivity"
           
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.google.android.gms.ads.AdActivity"
             
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>


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

</manifest>



Screenshot_2014-05-26-10-31-17-1.png
Reply all
Reply to author
Forward
0 new messages