Android 5.0 (L) Service Intent must be explicit in Google analytics

后端 未结 11 1642
南旧
南旧 2020-11-29 02:01

My code worked in <5 but in Android 5.0 I\'m running into an issue that I don\'t quite understand.

10-23 10:18:18.945: E/AndroidRuntime(8987): java.lang.I         


        
11条回答
  •  迷失自我
    2020-11-29 02:17

    If you're trying to use Google's Licensing mechanism, solution that worked for me:

    // explicit Intent, safe
    Intent serviceIntent = new Intent(ILicensingService.class.getName());
    serviceIntent.setPackage("com.android.vending");
    boolean bindResult = mContext.bindService(serviceIntent, this, Context.BIND_AUTO_CREATE);
    

    This is located in com/google/android/vending/licensing/LicenseChecker.java. Do a search for "Base64.decode("

    Edit:

    Adding reference to Google Licensing java file that has to be patched:

    com.google.android.vending.licensing.LicenseChecker.checkAccess(LicenseChecker.java:150)
    

    patch:

    new String(
    -    Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U="))),
    +    Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U=")))
    +    .setPackage("com.android.vending"), // this fix the 'IllegalArgumentException: Service Intent must be explicit'
         this, // ServiceConnection.
    

    Source: https://code.google.com/p/android/issues/detail?id=78505#c19

提交回复
热议问题