Android Question [Solved] Error when I change the PackageName in StickerPack to Whatsapp Library

asales

Expert
Licensed User
Longtime User
I'm testing the Sticker4W from @DonManfred (thanks!), but If I change the packagename "de.donmanfred.sticker" to another, I get an error.
In the first time I don't see no logs, but compile again, I get this error:
B4X:
main_activity_create (java line: 369)
java.lang.IllegalStateException: could not fetch from content provider, de.donmanfred.sticker.stickercontentprovider
    at com.sticker4w.StickerPackLoader.fetchStickerPacks(StickerPackLoader.java:48)
    at de.donmanfred.StickerPackLoaderwrapper.fetchStickerPacks(StickerPackLoaderwrapper.java:37)
    at de.donmanfred.sticker3.main._activity_create(main.java:369)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
    at de.donmanfred.sticker3.main.afterFirstLayout(main.java:104)
    at de.donmanfred.sticker3.main.access$000(main.java:17)
    at de.donmanfred.sticker3.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:790)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

The line in Activity_Create is correct:
B4X:
prov.Initialize("Provider",Application.PackageName&"."&"stickercontentprovider")

But I don't know how to fix it.

Thanks in advance for any tip.
 

DonManfred

Expert
Licensed User
Longtime User
How is you manifest looking (the manifest entry for this)?
I got told from another user that it does work perfectly for him in release mode. He was asking about debug mode.
Does it work for you using Release mode?
 
Upvote 0

asales

Expert
Licensed User
Longtime User
Yes. I use the release mode (obfuscated) in real device.

I am using your example.
The only change I made is in the package name:
"de.donmanfred.sticker2"
 
Upvote 0

asales

Expert
Licensed User
Longtime User
I checked the logs from your example and I get "null" in the log of this line:
B4X:
    prov.Initialize("Provider",Application.PackageName&"."&"stickercontentprovider")
Log("prov.Authority)
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
@DonManfred
really, when i change the package name it give crash
here is the logs

at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.SecurityException: Provider must not be exported
at android.support.v4.content.FileProvider.attachInfo(FileProvider.java:385)
at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
... 10 more
FATAL EXCEPTION: main
Process: b4a.example, PID: 22369
java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider: java.lang.SecurityException: Provider must not be exported
at android.app.ActivityThread.installProvider(ActivityThread.java:6581)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.SecurityException: Provider must not be exported
at android.support.v4.content.FileProvider.attachInfo(FileProvider.java:385)
at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
... 10 more
FATAL EXCEPTION: main
Process: b4a.example, PID: 6899
java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider: java.lang.SecurityException: Provider must not be exported
at android.app.ActivityThread.installProvider(ActivityThread.java:6581)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.SecurityException: Provider must not be exported
at android.support.v4.content.FileProvider.attachInfo(FileProvider.java:385)
at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
... 10 more
FATAL EXCEPTION: main
Process: b4a.example, PID: 13486
java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider: java.lang.SecurityException: Provider must not be exported
at android.app.ActivityThread.installProvider(ActivityThread.java:6581)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.SecurityException: Provider must not be exported
at android.support.v4.content.FileProvider.attachInfo(FileProvider.java:385)
at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
... 10 more
FATAL EXCEPTION: main
Process: b4a.example, PID: 15132
java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider: java.lang.SecurityException: Provider must not be exported
at android.app.ActivityThread.installProvider(ActivityThread.java:6581)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.SecurityException: Provider must not be exported
at android.support.v4.content.FileProvider.attachInfo(FileProvider.java:385)
at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
... 10 more
FATAL EXCEPTION: main
Process: b4a.example, PID: 16573
java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider: java.lang.SecurityException: Provider must not be exported
at android.app.ActivityThread.installProvider(ActivityThread.java:6581)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.SecurityException: Provider must not be exported
at android.support.v4.content.FileProvider.attachInfo(FileProvider.java:385)
at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
... 10 more
FATAL EXCEPTION: main
Process: b4a.example, PID: 20452
java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider: java.lang.SecurityException: Provider must not be exported
at android.app.ActivityThread.installProvider(ActivityThread.java:6581)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.SecurityException: Provider must not be exported
at android.support.v4.content.FileProvider.attachInfo(FileProvider.java:385)
at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
... 10 more
FATAL EXCEPTION: main
Process: b4a.example, PID: 23472
java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider: java.lang.SecurityException: Provider must not be exported
at android.app.ActivityThread.installProvider(ActivityThread.java:6581)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.SecurityException: Provider must not be exported
at android.support.v4.content.FileProvider.attachInfo(FileProvider.java:385)
at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
... 10 more
FATAL EXCEPTION: main
Process: b4a.example, PID: 25926
java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider: java.lang.SecurityException: Provider must not be exported
at android.app.ActivityThread.installProvider(ActivityThread.java:6581)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.SecurityException: Provider must not be exported
at android.support.v4.content.FileProvider.attachInfo(FileProvider.java:385)
at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
... 10 more
FATAL EXCEPTION: InLocoMedia Receiver
Process: hands.android.webmotors, PID: 17751
java.lang.IllegalStateException: Not allowed to start service Intent { act=com.inlocomedia.android.JGIY1K1Z5SA4VTPSZ26F cmp=hands.android.webmotors/com.inlocomedia.android.location.InLocoMediaService }: app is in background uid UidRecord{6412595 u0a209 CEM idle procs:1 seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1538)
at android.app.ContextImpl.startService(ContextImpl.java:1484)
at android.content.ContextWrapper.startService(ContextWrapper.java:663)
at com.inlocomedia.android.location.g$b.b(SourceCode:60)
at com.inlocomedia.android.location.private.ah$1.run(SourceCode:89)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
FATAL EXCEPTION: main
Process: b4a.example, PID: 29513
java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider: java.lang.SecurityException: Provider must not be exported
at android.app.ActivityThread.installProvider(ActivityThread.java:6581)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.SecurityException: Provider must not be exported
at android.support.v4.content.FileProvider.attachInfo(FileProvider.java:385)
at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
... 10 more
FATAL EXCEPTION: main
Process: de.donmanfred.sticker, PID: 17521
java.lang.RuntimeException: Unable to get provider de.donmanfred.sticker.starter$MyContentProvider: java.lang.RuntimeException: contents.json file has some issues: contents.json
at android.app.ActivityThread.installProvider(ActivityThread.java:6581)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.RuntimeException: contents.json file has some issues: contents.json
at com.sticker4w.StickerContentProvider.readContentFile(StickerContentProvider.java:171)
at com.sticker4w.StickerContentProvider.getStickerPackList(StickerContentProvider.java:176)
at com.sticker4w.StickerContentProvider.onCreate(StickerContentProvider.java:112)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1925)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1900)
at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
... 10 more
Caused by: java.io.FileNotFoundException: contents.json
at android.content.res.AssetManager.openAsset(Native Method)
at android.content.res.AssetManager.open(AssetManager.java:388)
at android.content.res.AssetManager.open(AssetManager.java:362)
at com.sticker4w.StickerContentProvider.readContentFile(StickerContentProvider.java:168)
... 15 more
FATAL EXCEPTION: main
Process: de.donmanfred.sticker, PID: 20139
java.lang.RuntimeException: Unable to get provider de.donmanfred.sticker.starter$MyContentProvider: java.lang.RuntimeException: contents.json file has some issues: contents.json
at android.app.ActivityThread.installProvider(ActivityThread.java:6581)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.RuntimeException: contents.json file has some issues: contents.json
at com.sticker4w.StickerContentProvider.readContentFile(StickerContentProvider.java:171)
at com.sticker4w.StickerContentProvider.getStickerPackList(StickerContentProvider.java:176)
at com.sticker4w.StickerContentProvider.onCreate(StickerContentProvider.java:112)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1925)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1900)
at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
... 10 more
Caused by: java.io.FileNotFoundException: contents.json
at android.content.res.AssetManager.openAsset(Native Method)
at android.content.res.AssetManager.open(AssetManager.java:388)
at android.content.res.AssetManager.open(AssetManager.java:362)
at com.sticker4w.StickerContentProvider.readContentFile(StickerContentProvider.java:168)
... 15 more
FATAL EXCEPTION: main
Process: de.donmanfred.sticker, PID: 22635
java.lang.RuntimeException: Unable to get provider de.donmanfred.sticker.starter$MyContentProvider: java.lang.RuntimeException: contents.json file has some issues: contents.json
at android.app.ActivityThread.installProvider(ActivityThread.java:6581)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.RuntimeException: contents.json file has some issues: contents.json
at com.sticker4w.StickerContentProvider.readContentFile(StickerContentProvider.java:171)
at com.sticker4w.StickerContentProvider.getStickerPackList(StickerContentProvider.java:176)
at com.sticker4w.StickerContentProvider.onCreate(StickerContentProvider.java:112)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1925)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1900)
at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
... 10 more
Caused by: java.io.FileNotFoundException: contents.json
at android.content.res.AssetManager.openAsset(Native Method)
at android.content.res.AssetManager.open(AssetManager.java:388)
at android.content.res.AssetManager.open(AssetManager.java:362)
at com.sticker4w.StickerContentProvider.readContentFile(StickerContentProvider.java:168)
... 15 more
FATAL EXCEPTION: main
Process: de.donmanfred.sticker, PID: 24744
java.lang.RuntimeException: Unable to get provider de.donmanfred.sticker.starter$MyContentProvider: java.lang.RuntimeException: contents.json file has some issues: contents.json
at android.app.ActivityThread.installProvider(ActivityThread.java:6581)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.RuntimeException: contents.json file has some issues: contents.json
at com.sticker4w.StickerContentProvider.readContentFile(StickerContentProvider.java:171)
at com.sticker4w.StickerContentProvider.getStickerPackList(StickerContentProvider.java:176)
at com.sticker4w.StickerContentProvider.onCreate(StickerContentProvider.java:112)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1925)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1900)
at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
... 10 more
Caused by: java.io.FileNotFoundException: contents.json
at android.content.res.AssetManager.openAsset(Native Method)
at android.content.res.AssetManager.open(AssetManager.java:388)
at android.content.res.AssetManager.open(AssetManager.java:362)
at com.sticker4w.StickerContentProvider.readContentFile(StickerContentProvider.java:168)
... 15 more
FATAL EXCEPTION: main
Process: de.donmanfred.sticker, PID: 26069
java.lang.RuntimeException: Unable to get provider de.donmanfred.sticker.starter$MyContentProvider: java.lang.RuntimeException: contents.json file has some issues: contents.json
at android.app.ActivityThread.installProvider(ActivityThread.java:6581)
Logger connected to: ce0916093b5e551d04
at android.app.ActivityThread.installConte--------- beginning of crash
--------- beginning of main
--------- beginning of system




i m changed the app packagename and on this line too
B4X:
in.putExtra("sticker_pack_authority", "douglas.app.teste.stickercontentprovider")
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
really, when i change the package name it give crash
i think i see the problem though it just crashes here without any log (must look into unfiltered log).
Looks like it is not possible to change this setting at runtime. Or i´m doing something wrong.

I´m investigating.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top