question

mutantbc avatar image
mutantbc asked

E/AndroidRuntime(17882): java.lang.NoClassDefFoundError

Hi I tried to integrate below sample to my existing App. But I am getting 03-07 23:43:25.540: E/AndroidRuntime(17882): java.lang.NoClassDefFoundError: com.amazon.device.ads.AdRegistration Am I missing something? @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); AdRegistration.setAppKey(getApplicationContext(), "0123456789ABCDEF0123456789ABCDEF"); // Programmatically create the AmazonAdLayout this.adView = new AdLayout(this, AdLayout.AdSize.AD_SIZE_320x50); LinearLayout layout = (LinearLayout) findViewById(R.id.mainLayout); // Set the correct width and height of the ad. LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); layout.addView(this.adView,lp); // If you declared AdLayout in your xml you would instead // replace the 3 lines above with the following line // this.adView = (AdLayout) findViewById( R.id.adview ); this.adView.loadAd(new AdTargetingOptions()); // async task to retrieve an ad }
mobile ads
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

epicofchaos avatar image
epicofchaos answered
mutantbc, It sounds like you do not have the Amazon Mobile Ad SDK being packaged with your application. Try following the instructions on the page. https://developer.amazon.com/sdk/mobileads/quick-start.html#Step1
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mutantbc avatar image
mutantbc answered
Hi, Actually I did all the steps specified here: https://developer.amazon.com/sdk/mobileads/quick-start.html#Step1 But when I deploy my application to an android phone I always get NoClassDefFoundError when it hit this line AdRegistration.setAppKey(getApplicationContext(), "0123456789ABCDEF0123456789ABCDEF"); I also change the app key as well to my app key.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Matt15@Amazon avatar image
Matt15@Amazon answered
Hey Mutantbc, The NoClassDefFoundError message will sometimes appear if you have not configured the Amazon Mobile Ads API jar correctly into your project or if you are trying to build the SimpleAdSample or FloatingAdSample without completely following the "Import/Existing Projects into Workspace" instructions in the sample app Readme. Your more recent forum posts seem to indicate that you've already overcome this problem. If you're still seeing the problem, please delete the Amazon Mobile Ads API jar from your project and start again by following these instructions: https://developer.amazon.com/sdk/mobileads/quick-start.html Thanks Matt
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mutantbc avatar image
mutantbc answered
Yes, my recent post indicate that I've already deploy to my android device. but no ads is showing though. No error also. Thanks
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sachin@Amazon avatar image
Sachin@Amazon answered
Hi Mutantbc, We will mark this thread as answered as the "NoClassDefFoundError " issue is been fixed now . However, we will track your other issue "Ads not showing" on your other thread. https://forums.developer.amazon.com/forums/thread.jspa?threadID=888&tstart=0
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.