1

I get the following error when trying to check the license of yn app:

java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.licensing.ILicensingService }

This happens in this code:

  Context AppContext=context;
            String packageName=AppContext.getPackageName();
            mLicenseCheckerCallback = new LicenseCheckerCallbackNew();
            String deviceId = Secure.getString(AppContext.getContentResolver(), 
Secure.ANDROID_ID);
            LicenseChecker mChecker;
            try{
                if(bstrict){
                    mChecker = new LicenseChecker(context, new StrictPolicy(),BASE64_PUBLIC_KEY);
                }else{
                    mChecker = new LicenseChecker(context, new ServerManagedPolicy(AppContext, new AESObfuscator(SALT, packageName, deviceId)),BASE64_PUBLIC_KEY);
                }
                mChecker.checkAccess(mLicenseCheckerCallback); <--------- Error
            }catch(Exception e){
                sendBackLicenseCheck("ApplicationError",0);
            }

All my values are filled correct : packageName, SALT, BASE64_PUBLIC_KEY, deviceId

My dependencies in gradle :

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support.test.espresso:espresso-core:2.2.2'
    compile 'com.android.support:multidex:1.0.2'
    compile 'com.android.support:appcompat-v7:27.0.1'
    compile 'com.android.support:design:27.0.1'
    testCompile 'junit:junit:4.12'
    compile files('libs/lvl.jar')
    compile files('libs/google-play-services.jar')
    compile 'com.facebook.android:facebook-android-sdk:4.29.0'
    compile files('libs/GoogleConversionTrackingSdk-2.2.4.jar')

}

This worked in the past. I have no clue, so I am asking here. Can someone help ?

mcfly soft
  • 11,289
  • 26
  • 98
  • 202

1 Answers1

0

If you starting a Service then it should be as follows .

Intent intent = new Intent(context,Service.class);
context.startService(intent);

Or you can use action.

Intent intent = new Intent("defined_action");
intent.setPackage("com.example.app");
context.startService(intent);

If its crash is from third party library .Then i suggest you to use the letest version of it .

ADM
  • 20,406
  • 11
  • 52
  • 83
  • Hi thanks for helping, BUT. You just explain how to use an intent. I know how to handle intents myself. As you can see, there is no intent in my code. The intent is instantieted inside the checkAccess from google. I added my gradle dependencies in the question. I guess I am using lvl.jar, which should be the newest. – mcfly soft Feb 25 '18 at 08:00
  • Yeah i have added it because it seems to be the same issue at first . Now you have edited its clear . Go through [This discussion](https://stackoverflow.com/questions/30059716/android-app-crashes-on-lollipop-service-intent-must-be-explicit) seems like it will help . – ADM Feb 25 '18 at 08:09
  • This doesn't help either. I can't adjust the google library. THe problem is also with newer API's. I wonder how to check lisence. This worked for me in older versions of my app. – mcfly soft Feb 25 '18 at 09:43
  • Well seems quite tricky . I have also gone through the issue mentioned at git . Same solution . keep digging. Go through git issues once may be you will find something useful . Or you can file a new one . – ADM Feb 25 '18 at 10:31