Hello everyone! May be it's a better question for ...
# touchlab-tools
l
Hello everyone! May be it's a better question for Multiplatform channel, but as my test project is mostly based on KampKit, I'll post it here. I took KampKit as foundation and added some features from PeopleInSpace and MultiplatformPlayground. The biggest change was probably adding jetpack compose dependencies to android build.gradle. Now when I try running android app, the project builds and even says "Launch succeeded", but the app does not start. There is an app icon created, but when I click, I get "App isn't installed". Can anyone give me a hint why this is happening? Here is the reproducer https://github.com/hlnstepanova/testKMP
r
Not sure off-hand. I've seen things like that go away by restarting the emulator or creating a new run configuration.
l
I've tried both emulator and test device, but with no success. I've just noticed that configurations look weird and also when I want to setup a new one, there is only one module choice. I think I have mistakes in gradle files, but no idea what it could be
message has been deleted
b
Hi Lena, I just tried to clone your repo, but it looks like it’s been deleted or made private. Were you able to solve your problem?
l
Hi Brady, I couldn't solve the problem. I must have missed something in build files, so decided to start new and take another approach to merging features. I've just restored the repo, so if you're interested, please take a look. I'd be happy to find the mistake.
b
Right on, I’ll give it a look
Hey I messed around with it and finally got it to build, and got your launch error. It looks like this:
Copy code
2021-03-16 16:52:56.275 12250-12250/? E/BaseDraggingActivity: Unable to launch. tag=AppInfo(id=-1 type=APP container=-1 screen=-1 cell(-1,-1) span(1,1) minSpan(1,1) rank=0 user=UserHandle{0} title=Activacation componentName=ComponentInfo{com.traveller.activacation/com.traveller.activacation.ui.MainActivity}) intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.traveller.activacation/.ui.MainActivity bnds=[35,624][237,882] }
    java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.traveller.activacation/.ui.MainActivity bnds=[35,624][237,882] } from ProcessRecord{9ec0b6 12250:com.google.android.apps.nexuslauncher/u0a6} (pid=12250, uid=10006) not exported from uid 10090
        at android.os.Parcel.createException(Parcel.java:1950)
        at android.os.Parcel.readException(Parcel.java:1918)
        at android.os.Parcel.readException(Parcel.java:1868)
        at android.app.IActivityManager$Stub$Proxy.startActivity(IActivityManager.java:3755)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1669)
        at android.app.Activity.startActivityForResult(Activity.java:4586)
        at com.android.launcher3.Launcher.startActivityForResult(SourceFile:1349)
        at android.app.Activity.startActivity(Activity.java:4901)
        at com.android.launcher3.BaseDraggingActivity.startActivitySafely(SourceFile:183)
        at com.android.launcher3.Launcher.startActivitySafely(SourceFile:1663)
        at com.android.launcher3.touch.ItemClickHandler.startAppShortcutOrInfoActivity(SourceFile:230)
        at com.android.launcher3.touch.ItemClickHandler.onClick(SourceFile:81)
        at com.android.launcher3.touch.ItemClickHandler.lambda$oPqR0koj5OQZ6VtyqmfcFGp5X0Q(Unknown Source:0)
        at com.android.launcher3.touch.-$$Lambda$ItemClickHandler$oPqR0koj5OQZ6VtyqmfcFGp5X0Q.onClick(Unknown Source:0)
        at android.view.View.performClick(View.java:6597)
        at android.view.View.performClickInternal(View.java:6574)
        at android.view.View.access$3100(View.java:778)
        at android.view.View$PerformClick.run(View.java:25885)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: android.os.RemoteException: Remote stack trace:
        at com.android.server.am.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:1788)
        at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:717)
        at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:544)
        at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1099)
        at com.android.server.am.ActivityStarter.execute(ActivityStarter.java:486)
To fix this, in AndroidManifest.xml, you’ll need to change
android:exported="false"
to
android:exported="true"
.
For me, there is still a crash after fixing this, and it looks like Koin is having trouble with how it’s configured. You’ll need to specify an implementation of
AppInfo
and let Koin know about it.
Copy code
2021-03-16 16:56:44.344 13657-13657/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.traveller.activacation, PID: 13657
    java.lang.RuntimeException: Unable to create application com.traveller.activacation.ActivacationApp: org.koin.core.error.NoBeanDefFoundException: No definition found for class:'com.traveller.activacation.di.AppInfo'. Check your definitions!
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5876)
        at android.app.ActivityThread.access$1100(ActivityThread.java:199)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: org.koin.core.error.NoBeanDefFoundException: No definition found for class:'com.traveller.activacation.di.AppInfo'. Check your definitions!
        at org.koin.core.scope.Scope.throwDefinitionNotFound(Scope.kt:241)
        at org.koin.core.scope.Scope.resolveInstance(Scope.kt:210)
        at org.koin.core.scope.Scope.get(Scope.kt:194)
        at com.traveller.activacation.di.CommonModuleKt.initKoin(CommonModule.kt:101)
        at com.traveller.activacation.ActivacationApp.onCreate(ActivacationApp.kt:18)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871)
        at android.app.ActivityThread.access$1100(ActivityThread.java:199) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6669) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
l
@Brady Aiello Thank you! I misunderstood what android:exported means and thought it was right to use "false", would have never thought to search there! Fixed that and AppInfo now, looks good 🙂
b
Right on! 😄