Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find class 'android.app.AppOpsManager' with Android 4.2.2 #384

Closed
dapriett opened this issue Mar 16, 2016 · 4 comments
Closed

Comments

@dapriett
Copy link

There is an issue with my nativescript-google-maps-sdk plugin with Android 4.2.2 (see: dapriett/nativescript-google-maps-sdk#7) where the map shows up blank.

The Android logs show this:

01-21 00:08:33.653: I/ActivityManager(383): Displayed com.android.systemui/.recent.RecentsActivity: +97ms
01-21 00:08:43.261: I/dalvikvm(2925): Could not find method android.app.Notification$Builder.setLocalOnly, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
01-21 00:08:43.261: I/dalvikvm(2925): DexOpt: access denied from Lcom/google/android/gms/common/GooglePlayServicesUtil; to field Landroid/app/Notification;.extras
01-21 00:08:43.261: I/dalvikvm(2925): Could not find method android.os.UserManager.getApplicationRestrictions, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzap
01-21 00:08:43.261: E/dalvikvm(2925): Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzb
01-21 00:08:43.261: W/dalvikvm(2925): VFY: unable to resolve check-cast 24 (Landroid/app/AppOpsManager;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
01-21 00:08:43.261: I/dalvikvm(2925): Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzh

Not sure if it's related to the multidex issue here: #344 or something else. There is a demo app here to try it out: https://github.com/dapriett/nativescript-google-maps-sdk/tree/master/demo

@slavchev
Copy link

Hi @dapriett

According the documentation AppOpsManager is introduced in API level 19. By default, {N} targets API 17 as minimal SDK version so I would suggest to edit manually AndroidManifest.xml and build.gradle files. I guess we will see more of this scenario in future so it might be a good idea to open an issue to support such configuration via tns command line.

EDIT: ignore my comment, it seems the issue is elsewhere.

@atanasovg atanasovg added this to the 2.0.0 (Under Review) milestone Mar 18, 2016
@slavchev
Copy link

Hi @dapriett

I had a second look at the issue and after I cleared my confusion about the metadata it seems that you run your app on API level 17 (Android 4.2.2). Can you confirm that? If that the case the case I am afraid this scenario is not supported in Android because AppOpsManager is avaiable in API level 19 and latter (see my previous comment).

@dapriett
Copy link
Author

Hi @slavchev

The demo app runs with the default API level set by Nativescript, so yeah level 17. I'm not actually calling AppOpsManager anywhere, it's using the Android Google Play Services Maps SDK com.google.android.gms:play-services-maps. Google Maps should support API level 17. I can create a new Android Map project in Android Studio targeted for 17, works fine - so not sure what the issue is. I tried including the com.android.support:appcompat-v7 library, but makes no difference. Any suggestions? Is my plugin doing something incorrectly?

@slavchev
Copy link

@dapriett Finally I managed to compile and run your app (btw it seems you npm is broken; it doesn't contain map-view* files). In short, I built a *.apk file and deployed it on Android 5.1.1 device and on Android 4.2.2 devices. Indeed, the app works fine on the 5.1.1 device and it shows an empty activity on the 4.2.2 device.
ddms-ui-hierarchy
However the map view is in the UI hierarchy which makes me thing that the problem is not related to {N} runtime.

Also, I found this stackoverflow thread which discusses similar issue. So far I don't think it is {N} issue so I will leave it up to you. Please share your findings and feel free to ping me back if you think it is {N} problem.

@Plamen5kov Plamen5kov added the bug label Apr 7, 2016
@Plamen5kov Plamen5kov removed this from the 2.0.0 milestone Apr 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants