聪明的点击权限

时间:2017-08-01 12:41:19

标签: android performance clevertap

我正在我的应用程序中集成claverTap,我遵循了集成文档,但是当我运行我的应用时出现以下错误: -

  

com.clevertap.android.sdk.exceptions.CleverTapPermissionsNotSatisfied:   需要权限:android.permission.INTERNET

问题,即使我在AndroidManifest.xml文件中也添加了互联网权限,

应用程序类代码

public class MyApplication extends Application {
public static CleverTapAPI cleverTap;
@Override
public void onCreate() {
    Log.e("application","class0");

        CleverTapAPI.setDebugLevel(1);
        CleverTapAPI.changeCredentials("","");
        ActivityLifecycleCallback.register(this); // Must be called before super.onCreate() of Application Class
        Log.e("application","class1");

        try {
            cleverTap = CleverTapAPI.getInstance(getApplicationContext());
            Log.e("application","class2");

        } catch (CleverTapMetaDataNotFoundException e) {
            e.printStackTrace();
        } catch (CleverTapPermissionsNotSatisfied cleverTapPermissionsNotSatisfied) {
            cleverTapPermissionsNotSatisfied.printStackTrace();

    }
    super.onCreate();

}

如果我更改>支持版本到v4它将显示异常

E/CleverTap: Error checking Google Play services availability
                                                         java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/GoogleApiAvailability;
                                                             at com.clevertap.android.sdk.DeviceInfo.isGooglePlayServicesAvailable(DeviceInfo.java:274)

2 个答案:

答案 0 :(得分:1)

好像你在旧图书馆。

该库依赖于Android v4支持库,最低版本为23.1.1。

确保添加此内容。有关支持库的更多信息,请访问

compile 'com.android.support:design:22.2.0'
compile 'com.android.support:appcompat-v7:22.2.0'

我希望它对你有用。

答案 1 :(得分:1)

您是否尝试过授权申请?当您将应用程序安装到手机时,它会自动关闭权限,因此您需要手动提供它们!