Recent

Author Topic: Bug in LAMW IDE/Wizard? (jFileProvider and Manifest)  (Read 157 times)

Manlio

  • Full Member
  • ***
  • Posts: 104
  • Pascal dev
Bug in LAMW IDE/Wizard? (jFileProvider and Manifest)
« on: November 19, 2020, 04:25:52 pm »
I'm facing the following problem, and I can't tell if I'm doing something wrong, or if there is a bug in LAMW -- and in either case, any help will be appreciated!

Using the latest LAMW with a project that contains a jFileProvider component, my AndroidManifest.xml includes the following snippet:

Code: XML  [Select][+][-]
  1.   </activity>
  2.   <provider android:name=".jFileProvider" android:authorities="com.example.ee9" android:exported="true" android:grantUriPermissions="true"/>
  3. </application>
  4. </manifest>
  5.  

Notice that "com.example.ee9" is the package name of my app.

Now, when I compile the the LAMW library, the manifest file gets automatically modified, like in this other snippet:

Code: XML  [Select][+][-]
  1. </activity>
  2. <provider android:name=".jFileProvider" android:authorities="org.lamw.fileprovider" android:exported="true" android:grantUriPermissions="true"/>
  3.   <provider android:name=".jFileProvider" android:authorities="com.example.ee9" android:exported="true" android:grantUriPermissions="true"/>
  4. </application>
  5. </manifest>
  6.  

As you can see:

1) An additional "provider" tag is added, even though the tag for that provider was already there

2) This new provider tag uses "org.lamw.fileprovider" as the package name (as if it were in the demo app) instead of my app's package ID.

It would seem that when LAMW/IDE Wizard is checking the manifest file, it doesn't notice that the provider tag is there, and adds a new one with the wrong package ID. Perhaps LAMW thinks that "org.lamw.fileprovider" is the correct package ID, and when it doesn't find it, it adds it... if it looked for the right package ID it would see that it is already there.

... or am I doing something wrong?

Thanks for any help!
manlio mazzon gmail

jmpessoa

  • Hero Member
  • *****
  • Posts: 1663
Re: Bug in LAMW IDE/Wizard? (jFileProvider and Manifest)
« Reply #1 on: November 19, 2020, 06:12:17 pm »

Quote
or if there is a bug in LAMW -- and in either case, any help will be appreciated!

Ok. I will fix it?

But, this cause some error in your project? or running the App?

Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Manlio

  • Full Member
  • ***
  • Posts: 104
  • Pascal dev
Re: Bug in LAMW IDE/Wizard? (jFileProvider and Manifest)
« Reply #2 on: November 19, 2020, 06:17:18 pm »

But, this cause some error in your project? or running the App?


Sorry, I forgot to mention that! The project compiles OK, but building the APK with gradle fails because of that.

I'm using gradle 5.3.1. The error message was that gradle failed to merge manifests. Eventually I figured out that if I remove that extra tag before calling gradle, then it works again.
manlio mazzon gmail

jmpessoa

  • Hero Member
  • *****
  • Posts: 1663
Re: Bug in LAMW IDE/Wizard? (jFileProvider and Manifest)
« Reply #3 on: November 19, 2020, 06:40:32 pm »

Good.

I will try some fix.

A side note: LAMW now need gradle to "6.6.1"
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

jmpessoa

  • Hero Member
  • *****
  • Posts: 1663
Re: Bug in LAMW IDE/Wizard? (jFileProvider and Manifest)
« Reply #4 on: November 19, 2020, 09:16:31 pm »
Fixed!!!

NOTE:

you can get many "providers" like this:

Code: Pascal  [Select][+][-]
  1. <provider android:name=".jFileProvider" android:authorities="org.lamw.appcompatcollapsingtoolbardemo1" android:exported="true" android:grantUriPermissions="true"/>
  2. <provider android:name="androidx.core.content.FileProvider" android:authorities="org.lamw.appcompatcollapsingtoolbardemo1.fileprovider" android:exported="false" android:grantUriPermissions="true"><meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/support_provider_paths"/></provider>
  3.  
  4.  

And that is OK!!!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018