我正在尝试使用AdvertisingIDClIEnt来获取我的AIR应用程序的广告ID.所以我确实喜欢AdvertisingIDClIEnt.Info adInfo = AdvertisingIDClIEnt.getAdvertisingIDInfo(context).
我没有得到任何编译时错误.我从中生成了ANE.当控件遇到此语句时,它会立即抛出NoClassDefFoundError.我不知道到底发生了什么.
这是我的扩展代码
public class GetAdvertismentID implements FREFunction{ @OverrIDe public FREObject call(FREContext arg0, FREObject[] arg1) { Activity activity = arg0.getActivity(); Context context = activity.getApplicationContext(); String advertID = "initializeByGet\n"; try { AdvertisingIDClIEnt.Info adInfo = AdvertisingIDClIEnt.getAdvertisingIDInfo(context); //if (!adInfo.islimitAdTrackingEnabled()) //advertID = advertID + adInfo.getID(); } catch(Error e) { String stackTrace = ""; StackTraceElement[] stackArray = e.getStackTrace(); for(int i = 0; i < stackArray.length; i++) stackTrace += stackArray[i].toString() + "\n"; advertID += "Error::::::::::::::::"; advertID += "\nLocalized Message : " + e.getLocalizedMessage(); advertID += "\nMessage : " + e.getMessage(); advertID += "\ntoString() : " + e.toString(); advertID += "\nCause : " + e.getCause(); advertID += "\nStack Trace : " + stackTrace; } catch (Throwable t) { advertID += "\nThrowable::::::::::::"; advertID += "\nLocalized Message : " + t.getLocalizedMessage(); advertID += "\nMessage : " + t.getMessage(); advertID += "\ntoString() : " + t.toString(); } try { return FREObject.newObject(advertID); } catch(Exception e) { return null; } }}
当我在生成ANE后执行此 *** 作时,我将获得此输出:
initializeByGetError::::::::::::::::Localized Message : com.Google.androID.gms.ads.IDentifIEr.AdvertisingIDClIEntMessage : com.Google.androID.gms.ads.IDentifIEr.AdvertisingIDClIEnttoString() : java.lang.NoClassDefFoundError: com.Google.androID.gms.ads.IDentifIEr.AdvertisingIDClIEntCause : nullStack Trace : com.games24x7.extension.GetAdvertismentID.call(GetAdvertismentID.java:28)com.adobe.air.Entrypoints.EntryMainWrapper(Native Method)com.adobe.air.Entrypoints.EntryMainWrapper(Native Method)com.adobe.air.Entrypoints.EntryMain(Entrypoints.java:139)com.adobe.air.AndroIDActivityWrapper.LaunchApplication(AndroIDActivityWrapper.java:997)com.adobe.air.AndroIDActivityWrapper.onSurfaceInitialized(AndroIDActivityWrapper.java:1196)com.adobe.air.AIRwindowsurfaceVIEw.surfaceChanged(AIRwindowsurfaceVIEw.java:746)androID.vIEw.SurfaceVIEw.updateWindow(SurfaceVIEw.java:554)androID.vIEw.SurfaceVIEw.access0(SurfaceVIEw.java:81)androID.vIEw.SurfaceVIEw.onPreDraw(SurfaceVIEw.java:169)androID.vIEw.VIEwTreeObserver.dispatchOnPreDraw(VIEwTreeObserver.java:590)androID.vIEw.VIEwRootImpl.performTraversals(VIEwRootImpl.java:1793)androID.vIEw.VIEwRootImpl.handleMessage(VIEwRootImpl.java:2695)androID.os.Handler.dispatchMessage(Handler.java:99)androID.os.Looper.loop(Looper.java:156)androID.app.ActivityThread.main(ActivityThread.java:4987)java.lang.reflect.Method.invokeNative(Native Method)java.lang.reflect.Method.invoke(Method.java:511)com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:551)dalvik.system.NativeStart.main(Native Method)
我觉得这里的问题是,它无法在运行时找到某个类的路径.所以我尝试了所有选项:
Using the new Android Advertiser id inside an SDK,
How do I disable proguard for building my Android app?,
http://jmsliu.com/2143/add-admob-ads-in-flash-based-android-apps.html
不幸的是,它们都没有奏效.如果你们有人这样做,请帮助我.
我正在使用Flash Builder 4.7和AIR SDK 14.0.
解决方法:
在创建ANE时,您最好从JAR中提取Google-play-services类,并将它们包含在ANE的JAR中.见this.
如果最终APK本身内的类仍然缺失,请查看类似问题的my question(以及随后的答案).我试图将最新的Google Play服务SDK集成到我们的游戏中,我注意到AIR SDK中的dx工具正在剥离Google Play类.您可以使用this tool来确认这一点,以验证最终APK中是否确实缺少这些类.
更新:
我之前使用上面提到的相同的dex2jar工具将所需的类注入到APK中.但这不是必要的.您只需更新AIR SDK中的dx工具即可.
总结以上是内存溢出为你收集整理的android – AdvertisingIdClient.getAdvertisingIdInfo(context)正在考虑NoClassDefFoundError全部内容,希望文章能够帮你解决android – AdvertisingIdClient.getAdvertisingIdInfo(context)正在考虑NoClassDefFoundError所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)