question

benoit-lacelle avatar image
benoit-lacelle asked

Make Amazon Ad API compatiblt with Android Eclipse Plugin

We see the following error when integrating an AdLayout is a layout rendered in Eclipse with the official Android Eclipse plugin: The following classes could not be instantiated: - com.amazon.device.ads.AdLayout (Open Class, Show Error Log) See the Error Log (Window > Show View) for more details. Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse java.lang.NoClassDefFoundError: Could not initialize class com.amazon.device.ads.InternalAdRegistration at com.amazon.device.ads.AdLayout.initialize(AdLayout.java:186) at com.amazon.device.ads.AdLayout.initialize(AdLayout.java:177) at com.amazon.device.ads.AdLayout. (AdLayout.java:121) at sun.reflect.NativeConstructorAccessorImpl.newInstance0( at sun.reflect.NativeConstructorAccessorImpl.newInstance( at sun.reflect.DelegatingConstructorAccessorImpl.newInstance( at java.lang.reflect.Constructor.newInstance( at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:422) at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:179) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:135) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:727) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:373)
mobile ads
10 |5000

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

Bipin@Amazon avatar image
Bipin@Amazon answered
https://developer.amazon.com/sdk/mobileads/quick-start.html#Step1 the amazon-ads-x.y.z.jar has to be used, else you will get error because ClassLoader instance tries to load in the definition of a class. The Eclipse plugin ensures that the required API library files are available in your project build path. It puts API library files under the amazon-libs directory in your project and creates one or more Eclipse classpath containers for the libraries. For runtime dependencies, it marks the classpath containers as exported. Is the amazon-ads-xxx.jar is not marked as exported when selected ? Is the Amazon Mobile App SDK Eclipse Plugin up to date ?
10 |5000

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

benoit-lacelle avatar image
benoit-lacelle answered
Hi, I use maven to manage the dependencies. The issue seems to be an NPE because of a all with a null argument to a core android method. Not a classnotfound issue. I use the Android plugn for Eclipse. Not "Amazon Mobile App SDK Eclipse Plugin".
10 |5000

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

Pedro avatar image
Pedro answered
> the amazon-ads-x.y.z.jar has to be used, else you > will get error because ClassLoader instance tries to > load in the definition of a class. Im sorry to enter the conversation uninvited, but I disagree with this way of thinking. An error might be generated inside the library for an infinitude of reasons, including an error of the developer, but an exception should never be thrown from inside of the library scope to it's host program. From the stacktrace pasted by the OP, it should be Amazon library's responsibility to catch any exception that is generated by itself or by any of the methods called by it, and if it can't recover from the exception, simply silently disable the ads module and stop working, but not crash the host program. Best
10 |5000

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

Bipin@Amazon avatar image
Bipin@Amazon answered
The error in Graphical Layout to show the custom view of AdLayout is reported to team. We would work on this and post the feedback as soon as possible on this thread.
10 |5000

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

Sujoy@Amazon avatar image
Sujoy@Amazon answered
The issue is reported to concerned team. We will fix it in future release. Thanks.
10 |5000

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