Android Question CropIWA library and SDK 34

KZero

Active Member
Licensed User
Longtime User
Hello,

I'm using this library https://www.b4x.com/android/forum/threads/cropiwa.78298/ by @DonManfred in one of my apps
but when i changed the API level to 34 i get the following error
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Error occurred on line: 34 (Main)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:155)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
    at b4a.example.main._activity_create(main.java:397)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at b4a.example.main.afterFirstLayout(main.java:105)
    at b4a.example.main.access$000(main.java:17)
    at b4a.example.main$WaitForLayout.run(main.java:83)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:230)
    at android.os.Looper.loop(Looper.java:319)
    at android.app.ActivityThread.main(ActivityThread.java:8919)
    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.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:147)
    ... 19 more
Caused by: java.lang.SecurityException: b4a.example: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
    at android.os.Parcel.createExceptionOrNull(Parcel.java:3069)
    at android.os.Parcel.createException(Parcel.java:3053)
    at android.os.Parcel.readException(Parcel.java:3036)
    at android.os.Parcel.readException(Parcel.java:2978)
    at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:6157)
    at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1913)
    at android.app.ContextImpl.registerReceiver(ContextImpl.java:1853)
    at android.app.ContextImpl.registerReceiver(ContextImpl.java:1841)
    at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:772)
    at com.steelkiwi.cropiwa.image.CropIwaResultReceiver.register(CropIwaResultReceiver.java:48)
    at com.steelkiwi.cropiwa.CropIwaView.init(CropIwaView.java:75)
    at com.steelkiwi.cropiwa.CropIwaView.<init>(CropIwaView.java:47)
    at de.donmanfred.CropIwaViewWrapper._initialize(CropIwaViewWrapper.java:55)
    ... 22 more
** Activity (main) Resume **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
(i'm testing on the original library example file)

any assistance with this would be appreciated.
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Of course.

This is an example from PhoneEvents:
B4X:
if (Build.VERSION.SDK_INT >= 33) {
            BA.applicationContext.registerReceiver(br, fi, exported ? Context.RECEIVER_EXPORTED : Context.RECEIVER_NOT_EXPORTED);
        } else {
            BA.applicationContext.registerReceiver(br, fi);
        }

I think that in your case you don't need to export the receiver but I'm not 100% sure.
 
Upvote 0

KZero

Active Member
Licensed User
Longtime User
@KZero Try this version please.
it didn't work on android 14 devices with SDK 34
I'm getting the same error

attached an example project

** Service (starter) Start **
** Activity (main) Create (first time) **
main_activity_create (java line: 352)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:155)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
at b4a.example77.main._activity_create(main.java:352)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
at b4a.example77.main.afterFirstLayout(main.java:105)
at b4a.example77.main.access$000(main.java:17)
at b4a.example77.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:8919)
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.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:147)
... 15 more
Caused by: java.lang.SecurityException: b4a.example77: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
at android.os.Parcel.createExceptionOrNull(Parcel.java:3069)
at android.os.Parcel.createException(Parcel.java:3053)
at android.os.Parcel.readException(Parcel.java:3036)
at android.os.Parcel.readException(Parcel.java:2978)
at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:6157)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1913)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1853)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1841)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:772)
at com.steelkiwi.cropiwa.image.CropIwaResultReceiver.register(CropIwaResultReceiver.java:55)
at com.steelkiwi.cropiwa.CropIwaView.init(CropIwaView.java:75)
at com.steelkiwi.cropiwa.CropIwaView.<init>(CropIwaView.java:47)
at de.donmanfred.CropIwaViewWrapper._initialize(CropIwaViewWrapper.java:55)
... 18 more
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:16680)
at android.app.IActivityManager$Stub.onTransact$registerReceiverWithFeature$(IActivityManager.java:11613)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2961)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3199)
at android.os.Binder.execTransactInternal(Binder.java:1375)
*** Service (starter) Create ***
 

Attachments

  • CropIwa.zip
    408.3 KB · Views: 23
Upvote 0

KZero

Active Member
Licensed User
Longtime User
I´m getting NO ERROR.

But it also crop not anything.

How is a crop initiated? I can´t remember. It´s a 7 Years old Library
if you see the crop control then it's working
it's working on older devices that not running on Android 14
on android 14 devices just adding the control to the view without any code cause the previous error
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
if you see the crop control then it's working
i do see the control (i can move and/or resize the controls)

PD: Edit: Ohh, i see my Device is not running Android 14.
I only have a Android 12 Device here.

Need to check later at home if my other device is using another Androidversion.....
 
Upvote 0
Top