Sketchware-Pro icon indicating copy to clipboard operation
Sketchware-Pro copied to clipboard

If you excluded certain Libraries, issues are present.

Open RoyTheReal opened this issue 1 year ago • 3 comments

Describe the bug If you exclude Sketchwares default Activity Library or Core Library you get errors even if you replace them with newer versions.

To Reproduce Steps to reproduce the behavior:

  1. In the newest Sketchware Pro snapshot, Exclude the Default Activity 1.3.0 and/or CoreLibrary
  2. Replace with newer version (ex. Activity 1.9.0) in local libraries
  3. Try to build project
  4. Notice that you get compile Errors OR the app crashes once built ...

Expected behavior You should be able to build the project with the new Activity version and Core version and if compiled, app shouldn't crash. Everything should work fine because new versions are present.

Crashes Crash Log when Excluding Default Core Library and replacing with Newest:

Process: com.my.newproject5, PID: 6009
java.lang.NoSuchFieldError: No field Companion of type Landroidx/lifecycle/ReportFragment$Companion; in class Landroidx/lifecycle/ReportFragment; or its superclasses (declaration of 'androidx.lifecycle.ReportFragment' appears in /data/app/~~SzgyVkkde-9KTFNeHYKy_w==/com.my.newproject5-6Cx8cH8NoUosWAt7Xrs7Lw==/base.apk!classes8.dex)
	at androidx.core.app.ComponentActivity.onCreate(ComponentActivity.kt:74)
	at androidx.activity.ComponentActivity.onCreate(ComponentActivity.java:314)
	at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:273)
	at com.my.newproject5.MainActivity.onCreate(MainActivity.java:68)
	at android.app.Activity.performCreate(Activity.java:8995)
	at android.app.Activity.performCreate(Activity.java:8964)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1456)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4146)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4322)
	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2685)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:230)
	at android.os.Looper.loop(Looper.java:319)
	at android.app.ActivityThread.main(ActivityThread.java:8934)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)```

RoyTheReal avatar May 31 '24 13:05 RoyTheReal

Crash Log when Excluding Activity 1.3.0 and replacing with latest:

Process: com.my.newproject2, PID: 30593
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/SavedStateHandleSupport;
	at androidx.activity.ComponentActivity.<init>(ComponentActivity.kt:287)
	at androidx.fragment.app.FragmentActivity.<init>(FragmentActivity.java:103)
	at androidx.appcompat.app.AppCompatActivity.<init>(AppCompatActivity.java:96)
	at com.my.newproject2.MainActivity.<init>(MainActivity.java:47)
	at java.lang.Class.newInstance(Native Method)
	at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
	at android.app.Instrumentation.newActivity(Instrumentation.java:1378)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4034)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4322)
	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2685)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:230)
	at android.os.Looper.loop(Looper.java:319)
	at android.app.ActivityThread.main(ActivityThread.java:8934)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Caused by: java.lang.ClassNotFoundException: androidx.lifecycle.SavedStateHandleSupport
	... 20 more```

RoyTheReal avatar May 31 '24 18:05 RoyTheReal

This happens when replacing other libraries as well.

RoyTheReal avatar May 31 '24 18:05 RoyTheReal

Yeah I tried to do the same a lot of times, but all in vain. I had newer versions of the "AppCompat" and "AppCompat Resources" library and tried to exclude them with the newer versions enabled, but the app always freezed on startup.

HehehBoiii78 avatar Jun 20 '24 19:06 HehehBoiii78

I think you should add/update androidx.lifecycle dependency too.

hasrat-ali avatar Aug 07 '24 14:08 hasrat-ali

Libraries have specific dependencies and they have specific versions too. You can try downloading e.g. AndroidX activity 1.3.0 with the Local library Downloader and it'll download the correct dependencies as well, e.g. the correct AndroidX lifecycle version.

j-px avatar Aug 07 '24 14:08 j-px