本文介绍了如何将CreativeSDKImage与现有的Parse Android项目集成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我遇到的问题是我有一个依赖于Parse的现有项目。我的问题是如何集成Adobe CreativeSDKImage,因为它扩展了MultiDexApplication,而Parse Application(Class)扩展了Application。 现有项目例如(MyApp extends Application)import android.app .Application; CreativeSDK基于ADOBE CREATIVE SDK IMAGE GUIDE例如(CreativeSDKImageSampleApp extends)import android.support.multidex.MultiDexApplication; 经过几个小时试图找出我的应用程序现在每次启动时崩溃的原因,我注意到Parse.initilize是问题,或者如果我错了可能会纠正我,因为我也怀疑扩展MultiDexApplication可能是原因。我在这里阅读了使用MultiDexApplication的限制作为参考;建立MULTIDEX 请看下面的代码,帮助我将Parse与CreativeSDKImage应用程序集成。 package com.aviary.android.sample; import android.support.multidex.MultiDexApplication; import com.aviary.android.feather.sdk.IAviaryClientCredentials; import com.parse.Parse; import com.parse.ParseACL; import com.parse.ParseUser; public class MyApplication extends MultiDexApplication implements IAviaryClientCredentials { @ Override public void onCreate(){ super 。的onCreate(); init(); } private void init(){ // 启用本地数据存储。 Parse.enableLocalDatastore(getApplicationContext()); // 在此处添加初始化代码 Parse.initialize ( this ); ParseUser.enableAutomaticUser(); ParseACL defaultACL = new ParseACL(); // 可选择启用公共读取访问权限。 // defaultACL.setPublicReadAccess(true); ParseACL.setDefaultACL(defaultACL,true); } @覆盖 public String getBillingKey(){ return ; } @覆盖 public String getClientID(){ return 您的客户ID; } @覆盖 public String getClientSecret(){ return 您的客户秘密; } } 运行代码时出现此错误; 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:FATAL EXCEPTION:main 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:处理:com.aviary.android.sample,PID: 3700 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:java.lang.NoSuchMethodError: class Lcom / squareup / okhttp / OkHttpClient中没有虚方法setFollowRedirects(Z)V;或其 super 类(' com.squareup的声明。 okhttp.OkHttpClient'出现在/data/app/com.aviary.android.sample-1/base.apk) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:at com.parse.ParseOkHttpClient。< init>(ParseOkHttpClient.java: 58 ) 10 - 29 16 : 09 : 56 。 741 3700 - 3700 /? E / AndroidRuntime:at com.parse.ParseHttpClient.createClient(ParseHttpClient.java: 45 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:at com.parse.ParsePlugins $ Android.newHttpClient(ParsePlugins.java: 175 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:at com.parse.ParsePlugins.restClient(ParsePlugins.java: 91 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:at com.parse.Parse.initialize(Parse.java: 196 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:at com.parse.Parse.initialize(Parse.java: 161 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:at com.aviary.android.sample.MyApplication.init(MyApplication.java: 22 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:at com.aviary.android.sample.MyApplication.onCreate(MyApplication.java: 14 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:在android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java: 1013 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:在android.app.ActivityThread.handleBindApplication(ActivityThread.java: 4707 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:在android.app.ActivityThread.-wrap1(ActivityThread.java) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:在android.app.ActivityThread $ H.handleMessage(ActivityThread.java: 1405 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:在android.os.Handler.dispatchMessage(Handler.java: 102 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:在android.os.Looper.loop(Looper.java: 148 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:在android.app.ActivityThread.main(ActivityThread.java: 5417 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:at java.lang.reflect.Method.invoke(Native Method) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java: 726 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:在com.android.internal.os.ZygoteInit.main(ZygoteInit.java: 616 ) 10 - 29 16 : 0 解决方案 Android.newHttpClient(ParsePlugins.java: 175 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:at com.parse.ParsePlugins.restClient(ParsePlugins.java: 91 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:at com.parse.Parse.initialize(Parse.java: 196 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:at com.parse.Parse.initialize(Parse.java: 161 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:at com.aviary.android.sample.MyApplication.init(MyApplication.java: 22 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:at com.aviary.android.sample.MyApplication.onCreate(MyApplication.java: 14 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:在android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java: 1013 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:在android.app.ActivityThread.handleBindApplication(ActivityThread.java: 4707 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:在android.app.ActivityThread.-wrap1(ActivityThread.java) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:在android.app.ActivityThread H.handleMessage(ActivityThread.java: 1405 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:在android.os.Handler.dispatchMessage(Handler.java: 102 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:在android.os.Looper.loop(Looper.java: 148 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:在android.app.ActivityThread.main(ActivityThread.java: 5417 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:at java.lang.reflect.Method.invoke(Native Method) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:at com.android.internal.os.ZygoteInit MethodAndArgsCaller.run(ZygoteInit.java: 726 ) 10 - 29 16 : 09 : 56 。 741 3700 -3700 /? E / AndroidRuntime:在com.android.internal.os.ZygoteInit.main(ZygoteInit.java: 616 ) 10 - 29 16 : 0 The issue I have is that I have an existing project that depends on Parse. My question is how do I integrate Adobe CreativeSDKImage because it extends MultiDexApplication whereas Parse Application (Class) extends Application.Existing Project e.g (MyApp extends Application ) import android.app.Application;CreativeSDK based on ADOBE CREATIVE SDK IMAGE GUIDE e.g (CreativeSDKImageSampleApp extends) import android.support.multidex.MultiDexApplication;After hours of trying to figure out why my app now crashes everytime it starts-up, I noticed Parse.initilize is the issue or perhaps correct me if I'm wrong, as I also suspect extends MultiDexApplication might be the cause. I read limitations of using MultiDexApplication here for your reference; BUILDING MULTIDEXSo please look at the code below to help me in the integration of Parse with CreativeSDKImage Application.package com.aviary.android.sample;import android.support.multidex.MultiDexApplication;import com.aviary.android.feather.sdk.IAviaryClientCredentials;import com.parse.Parse;import com.parse.ParseACL;import com.parse.ParseUser;public class MyApplication extends MultiDexApplication implements IAviaryClientCredentials { @Override public void onCreate() { super.onCreate(); init(); } private void init() { // Enable Local Datastore. Parse.enableLocalDatastore(getApplicationContext()); // Add your initialization code here Parse.initialize(this); ParseUser.enableAutomaticUser(); ParseACL defaultACL = new ParseACL(); // Optionally enable public read access. // defaultACL.setPublicReadAccess(true); ParseACL.setDefaultACL(defaultACL, true); } @Override public String getBillingKey() { return ""; } @Override public String getClientID() { return "YOUR CLIENT ID"; } @Override public String getClientSecret() { return "YOUR CLIENT SECRET"; }}I am getting this error when I run the code;10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: FATAL EXCEPTION: main10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: Process: com.aviary.android.sample, PID: 370010-29 16:09:56.741 3700-3700/? E/AndroidRuntime: java.lang.NoSuchMethodError: No virtual method setFollowRedirects(Z)V in class Lcom/squareup/okhttp/OkHttpClient; or its super classes (declaration of 'com.squareup.okhttp.OkHttpClient' appears in /data/app/com.aviary.android.sample-1/base.apk)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.parse.ParseOkHttpClient.<init>(ParseOkHttpClient.java:58)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.parse.ParseHttpClient.createClient(ParseHttpClient.java:45)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.parse.ParsePlugins$Android.newHttpClient(ParsePlugins.java:175)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.parse.ParsePlugins.restClient(ParsePlugins.java:91)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.parse.Parse.initialize(Parse.java:196)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.parse.Parse.initialize(Parse.java:161)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.aviary.android.sample.MyApplication.init(MyApplication.java:22)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.aviary.android.sample.MyApplication.onCreate(MyApplication.java:14)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at android.app.ActivityThread.-wrap1(ActivityThread.java)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:148)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)10-29 16:0 解决方案 Android.newHttpClient(ParsePlugins.java:175)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.parse.ParsePlugins.restClient(ParsePlugins.java:91)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.parse.Parse.initialize(Parse.java:196)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.parse.Parse.initialize(Parse.java:161)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.aviary.android.sample.MyApplication.init(MyApplication.java:22)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.aviary.android.sample.MyApplication.onCreate(MyApplication.java:14)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at android.app.ActivityThread.-wrap1(ActivityThread.java)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at android.app.ActivityThreadH.handleMessage(ActivityThread.java:1405)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:148)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.android.internal.os.ZygoteInitMethodAndArgsCaller.run(ZygoteInit.java:726)10-29 16:09:56.741 3700-3700/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)10-29 16:0 这篇关于如何将CreativeSDKImage与现有的Parse Android项目集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
06-14 19:34