1

I used this answer in order to setup my Licence Verfication Library. In order to compile my app without errors I needed to add

android 
    {
        useLibrary 'org.apache.http.legacy'
    }

in the build.gradle of library. However, when I launch my app it crashes instantly, even if I remove abort(). Using debugger I could reach the line checker.checkAccess(licenseCheckerCallback). Maybe someone else tried it with Kotlin? How can I solve this?

Edit:

I noticed that I'm getting and error as in the step 24 of answer: Service Intent must be explicit: Intent { act=com.android.vending.licensing.ILicensingService }. However I don't know how can I solve it in Kotlin.

My stacktrace in red is:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: dreamy.protest, PID: 1539
    java.lang.RuntimeException: Unable to start activity ComponentInfo{dreamy.protest/ dreamy.protest.MainActivity}: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.licensing.ILicensingService }
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2951)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6718)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.licensing.ILicensingService }
        at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1519)
        at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1663)
        at android.app.ContextImpl.bindService(ContextImpl.java:1612)
        at android.content.ContextWrapper.bindService(ContextWrapper.java:698)
        at android.content.ContextWrapper.bindService(ContextWrapper.java:698)
        at com.google.android.vending.licensing.LicenseChecker.checkAccess(LicenseChecker.java:150)
        at dreamy.protest.MainActivity.doCheck(MainActivity.kt:57)
        at dreamy.protest.MainActivity.onCreate(MainActivity.kt:104)
        at android.app.Activity.performCreate(Activity.java:7144)
        at android.app.Activity.performCreate(Activity.java:7135)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2931)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6718) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
pbendzios
  • 21
  • 4
  • 1
    `it crashes instantly` perhaps it would be useful to add the stacktrace here for others to see – a_local_nobody Jan 16 '21 at 15:53
  • Ok, thanks. I got error as in step 24. Trying to solve this now. – pbendzios Jan 16 '21 at 16:02
  • I tried to paste the second code in the [first](https://stackoverflow.com/questions/30059716/android-app-crashes-on-lollipop-service-intent-must-be-explicit/30063674#30063674) answer. Android Studio converts it to Kotlin but ` mContext' remains `unresolved reference`. I placed it to `onCreate()`. Do you have any ideas how should I do that? – pbendzios Jan 16 '21 at 16:15
  • probably `this` – a_local_nobody Jan 16 '21 at 16:24
  • Ok, now I understand. Found that LicenseChecker:) – pbendzios Jan 16 '21 at 16:47

0 Answers0