重新打开应用程序时出现Moengage问题

时间:2017-10-23 08:32:47

标签: android moengage

应用程序到达前台时应用程序崩溃。 当应用程序被杀死并重新启动时,它不会崩溃但是当它被最小化并重新打开时,它会因以下异常而崩溃

  

java.lang.NoClassDefFoundError:   com.moengage.locationlibrary.LocationHandlerImpl                                                                    at java.lang.Class.classForName(Native Method)                                                                    at java.lang.Class.forName(Class.java:324)                                                                    at java.lang.Class.forName(Class.java:285)                                                                    在com.moengage.location.GeoManager.getHandler(GeoManager.java:33)                                                                    在com.moengage.core.MoEDispatcher.syncInAppsAndGeo(MoEDispatcher.java:209)                                                                    在com.moengage.core.MoEDispatcher.onStart(MoEDispatcher.java:159)                                                                    在com.moe.pushlibrary.MoEHelper.onNewIntent(MoEHelper.java:287)                                                                    在com.moe.pushlibrary.MoEHelper.onStartInternal(MoEHelper.java:324)                                                                    在com.moe.pushlibrary.MoEActivityLifeCycleCallBacks.onActivityStarted(MoEActivityLifeCycleCallBacks.java:33)                                                                    在android.app.Application.dispatchActivityStarted(Application.java:205)                                                                    在android.app.Activity.onStart(Activity.java:1146)                                                                    在android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:542)                                                                    在android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:177)                                                                    在android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1237)                                                                    在android.app.Activity.performStart(Activity.java:6253)                                                                    在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)                                                                    在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)                                                                    在android.app.ActivityThread.-wrap11(ActivityThread.java)                                                                    在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1344)                                                                    在android.os.Handler.dispatchMessage(Handler.java:102)                                                                    在android.os.Looper.loop(Looper.java:148)                                                                    在android.app.ActivityThread.main(ActivityThread.java:5417)                                                                    at java.lang.reflect.Method.invoke(Native Method)                                                                    在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:726)                                                                    在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)10-23   13:26:14.136 7406-7406 /? I /处理:发送信号。 PID:7406 SIG:9

我确实尝试过 NoClassDefFoundError 的解决方案,但它没有用。我很困惑它在重新启动时运行但不是从最小化状态到前景时。

以下是我的申请分类:

public class AppController extends Application implements PushManager.OnTokenReceivedListener {
    MoEHelper helper;

    @Override
    public void onCreate() {
        super.onCreate();

        helper = MoEHelper.getInstance(getApplicationContext());
        helper.autoIntegrate(this);
        PushManager.getInstance().setTokenObserver(this);

        Log.e("TAG", "onCreate() AppController");
        SharedPreferences pref = getApplicationContext().getSharedPreferences("MoTest", Context.MODE_PRIVATE);
        if (pref.contains("newInstall")) {
            helper.setExistingUser(true);
        } else {
            helper.setExistingUser(false);
        }

    }

    @Override
    public void onTokenReceived(String token) {
        Log.e("TAG", "Appcontroller Token: " + token);
    }
}

这是我的MainActivity:

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

    }
}

2 个答案:

答案 0 :(得分:2)

如果您具有位置权限,MoEngage SDK会假定您的应用程序具有位置服务依赖性,此处的情况也是如此。 也就是说,SDK提供了一种机制来排除位置库,以防您不想使用我们的地理围栏功能。这可以按如下方式完成:

compile ('com.moengage:moe-android-sdk:7.7.16') {
        exclude group: 'com.moengage', module: 'moe-location-lib'
    }

您可以参考官方文档here了解更多详情。

PS:我是MoEngage SDK的贡献成员之一。如果这还没有解决,请告诉我。

答案 1 :(得分:1)

检查 LocationHandlerImpl.java 文件,看看 GoogleApiClient LocationServices 是否已解决。您可能没有为Location服务添加依赖项。

如果未解决,请将相应的依赖项添加到Gradle文件

  

'com.google.android.gms:播放服务-位置:XXX'

同步并尝试重新运行它。那应该做的工作