Recent

Author Topic: [SOLVED] [LAMW] How to sign a Gradle .apk  (Read 4347 times)

pasquale

  • Sr. Member
  • ****
  • Posts: 267
    • Esposito Software
[SOLVED] [LAMW] How to sign a Gradle .apk
« on: January 10, 2021, 03:34:45 pm »
Hello,

I would like to know if and how it is possible to sign a Gradle .apk without using a Google developer account password.

So far I have managed to configure LAMW and build my myapp-armeabi-v7a-release-unsigned.apk in the C:\LAMWProjects\MyApp\build\outputs\apk\release folder.

After I execute gradle-local-apksigner.bat, I can find myapp-armeabi-v7a-release-unsigned-aligned.apk in the above mentioned release folder. There's no file named myapp-armeabi-v7a-release.apk or the like (I mean, without the word "unsigned" in its name).

In another forum, Segator said: "No, you don't need a Google account, but at least you need to sign your app and a Google account is not needed for that."

If I use Ant as an .apk builder, then myapp-release.apk is built correctly (without any Google developer account password) and it can run in the emulator without any problems. Is this only possible with Ant or am I missing something?

Do you need to buy a digital certificate to sign your apps in the same way as for MS Windows apps? Or can it be done free of charge?

Again, my question is, is it possible to sign a Gradle .apk without using a Google developer account password?

Any help will be greatly appreciated.
« Last Edit: January 15, 2021, 03:35:40 pm by pasquale »
Apple loves breaking backward compatibility to make money. If you want to be sure that your apps will never stop working, use Windows and trash macOS!

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: [LAMW] How to sign a Gradle .apk
« Reply #1 on: January 11, 2021, 05:51:50 am »

SOLVED!!!

Please, update the LAMW or simply the file "androidwizard_intf.pas"
ref:
https://github.com/jmpessoa/lazandroidmodulewizard/tree/master/android_wizard

Maybe, using LAMW Manager or some git client or simply copying.... [to LAMW folder ".....\android_wizard"]

Then re-install the "lazandroidwizardpack.lpk" [".....\android_wizard"] before you create a new project!

Hint: Close any LAMW project [and open a default lazarus project] before re-install a LAMW package....

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

pasquale

  • Sr. Member
  • ****
  • Posts: 267
    • Esposito Software
Re: [LAMW] How to sign a Gradle .apk
« Reply #2 on: January 11, 2021, 07:48:22 am »

SOLVED!!!

Please, update the LAMW or simply the file "androidwizard_intf.pas"
ref:
https://github.com/jmpessoa/lazandroidmodulewizard/tree/master/android_wizard

Maybe, using LAMW Manager or some git client or simply copying.... [to LAMW folder ".....\android_wizard"]

Then re-install the "lazandroidwizardpack.lpk" [".....\android_wizard"] before you create a new project!

Hint: Close any LAMW project [and open a default lazarus project] before re-install a LAMW package....

Thank you!!!

Thanks.

I have copied and pasted the file "androidwizard_intf.pas" overwriting the old one, unistalled the package "lazandroidwizardpack.lpk" and reinstalled it.

The signing procedure seemed to complete successfully because I no longer got the "Keystore password for signer #1:" message in the DOS window (which now closed up automatically at the end of the procedure). Unfortunately, the release version was not built in the release folder. I only got the two unsigned packages.

Try to believe (using 123456 as a password).
Apple loves breaking backward compatibility to make money. If you want to be sure that your apps will never stop working, use Windows and trash macOS!

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: [LAMW] How to sign a Gradle .apk
« Reply #3 on: January 11, 2021, 12:29:18 pm »
Please, try in new project....

And use the files just "as is" .... maybe can find some error...

Here all my tests using the files just "as is"  works!

And I repeated a test just now!

(see picture )

Quote
the DOS window (which now closed up automatically at the end of the procedure).

Here it continue open...
« Last Edit: January 11, 2021, 12:35:49 pm by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

pasquale

  • Sr. Member
  • ****
  • Posts: 267
    • Esposito Software
Re: [LAMW] How to sign a Gradle .apk
« Reply #4 on: January 11, 2021, 02:40:54 pm »
Please, try in new project....

And use the files just "as is" .... maybe can find some error...

Here all my tests using the files just "as is"  works!

And I repeated a test just now!

(see picture )

Quote
the DOS window (which now closed up automatically at the end of the procedure).

Here it continue open...

Thank you very much for your patience. I must find out what is wrong with the LAMW configuration on my computer.

I've created a brand-new project and captured each single screen.

Please find attached a PDF file with all of the screenshots.

Thanks again.
« Last Edit: January 11, 2021, 02:52:12 pm by pasquale »
Apple loves breaking backward compatibility to make money. If you want to be sure that your apps will never stop working, use Windows and trash macOS!

pasquale

  • Sr. Member
  • ****
  • Posts: 267
    • Esposito Software
Re: [LAMW] How to sign a Gradle .apk
« Reply #5 on: January 11, 2021, 02:45:12 pm »
Attached you will also find the updated version of androidwizard_intf.pas that I took from my LAMW folder for you to check, in case I made some mistakes when I overwrote the old version.

Thanks
Apple loves breaking backward compatibility to make money. If you want to be sure that your apps will never stop working, use Windows and trash macOS!

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: [LAMW] How to sign a Gradle .apk
« Reply #6 on: January 11, 2021, 06:48:36 pm »
Your "androidwizard_intf.pas"  is OK.

Please, try in new project....

And use the files just "as is" ..... don't change the generated files...

Maybe we can't use "underline" char in project name or in "Default Package name"....

Please try using a default project name....  (like "AppLAMWProject9"  and "org.lamw" )

Or maybe in "keytool_input.tx"  file we can't  use "underline" char
like "Esposito_Software"
« Last Edit: January 11, 2021, 07:41:36 pm by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

pasquale

  • Sr. Member
  • ****
  • Posts: 267
    • Esposito Software
Re: [LAMW] How to sign a Gradle .apk
« Reply #7 on: January 11, 2021, 07:47:28 pm »
Your "androidwizard_intf.pas"  is OK.

Please, try in new project....

And use the files just "as is" ..... don't change the generated files...

Maybe we can't use "underline" char in project name....

Please try using a default project name....  (like "AppLAMWProject9")

Or maybe in "keytool_input.tx"  file we can't  use "underline" char
like "Esposito_Software"

Nope, even with "untouched" files or removing the undescores, the result is exactly the same.

At this point, I think there can be two possible reasons: (1) the installation of LAMW went wrong and some files were not installed correctly; (2) there are some requirements needed to sign the .apk (e.g. the possession of some registration key) that I don't have.

I'll keep on trying.
Apple loves breaking backward compatibility to make money. If you want to be sure that your apps will never stop working, use Windows and trash macOS!

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: [LAMW] How to sign a Gradle .apk
« Reply #8 on: January 11, 2021, 08:37:39 pm »
Quote
(2) there are some requirements needed to sign the .apk (e.g. the possession of some registration key) that I don't have.

No. I don't have, too.

I just noted that in "Step 3"  picture You don't have   a "Installing....."   message, Why?

Please, create a simple gradle project and send me....  "as is"....

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

pasquale

  • Sr. Member
  • ****
  • Posts: 267
    • Esposito Software
Re: [LAMW] How to sign a Gradle .apk
« Reply #9 on: January 11, 2021, 09:42:18 pm »
Quote
(2) there are some requirements needed to sign the .apk (e.g. the possession of some registration key) that I don't have.

No. I don't have, too.

I just noted that in "Step 3"  picture You don't have   a "Installing....."   message, Why?

Please, create a simple gradle project and send me....  "as is"....

Thank you.
Attached you will find the sources of a gradle project. Consider that I had to delete some folders not to exceed the size limit for the attachments.
Apple loves breaking backward compatibility to make money. If you want to be sure that your apps will never stop working, use Windows and trash macOS!

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: [LAMW] How to sign a Gradle .apk
« Reply #10 on: January 12, 2021, 04:30:25 pm »

You don't send me a new project "as is"....

(that is, all defaults.... and  don't  compile it!)

But I noted some small differences with my LAMW install...

Maybe you can update using LAMW manager:

from here:
https://github.com/DanielOliveiraSouza/LAMW4Windows-installer

Quote
How to update LAMW framework

Go to folder C:\lamw_manager
Right-click lamw_manager.bat and select Run as administrator

Please send me the "print screen"  of your LAMW "Paths Settings"

"Tools"  --> "" "[LAMW] ...."  --> "Paths Settings  ..."


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

pasquale

  • Sr. Member
  • ****
  • Posts: 267
    • Esposito Software
Re: [LAMW] How to sign a Gradle .apk
« Reply #11 on: January 12, 2021, 04:37:31 pm »

You don't send me a new project "as is"....

(that is, all defaults.... and  don't  compile it!)

But I noted some small differences with my LAMW install...

Maybe you can update using LAMW manager:

from here:
https://github.com/DanielOliveiraSouza/LAMW4Windows-installer

Quote
How to update LAMW framework

Go to folder C:\lamw_manager
Right-click lamw_manager.bat and select Run as administrator

Please send me the "print screen"  of your LAMW "Paths Settings"

"Tools"  --> "" "[LAMW] ...."  --> "Paths Settings  ..."


Thank you!

Here it is. Are the paths OK?
Apple loves breaking backward compatibility to make money. If you want to be sure that your apps will never stop working, use Windows and trash macOS!

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: [LAMW] How to sign a Gradle .apk
« Reply #12 on: January 12, 2021, 05:05:22 pm »
Yes! The paths are OK!

So, I don't understand why this difference:

My Project *.lpi
Quote
<CustomOptions Value="-Xd -CfSoft -CpARMV7A -XParm-linux-androideabi- -FDC:\android\ndkr18b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin"/>

Your Project *.lpi  don't have  "-FDC:...........",  why?  weird ....

Quote
<CustomOptions Value="-Xd -CfVFPv3 -CpARMV7A -XParm-linux-androideabi-"/>

Maybe if you click OK in the "Setting Paths"  can solve this issue...

My premise is the radio "NDK Version"  don't was captured....
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

pasquale

  • Sr. Member
  • ****
  • Posts: 267
    • Esposito Software
Re: [LAMW] How to sign a Gradle .apk
« Reply #13 on: January 12, 2021, 07:41:37 pm »
Yes! The paths are OK!

So, I don't understand why this difference:

My Project *.lpi
Quote
<CustomOptions Value="-Xd -CfSoft -CpARMV7A -XParm-linux-androideabi- -FDC:\android\ndkr18b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin"/>

Your Project *.lpi  don't have  "-FDC:...........",  why?  weird ....

Quote
<CustomOptions Value="-Xd -CfVFPv3 -CpARMV7A -XParm-linux-androideabi-"/>

Maybe if you click OK in the "Setting Paths"  can solve this issue...

My premise is the radio "NDK Version"  don't was captured....

I clicked on OK and now you can see the line -FDC:\android\ndkr18b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin" in the .lpi file.

Unfortunately, this does not solve the problem.

So, the file gradle-local-apksigner.bat can create the two release unsigned .apk files without any problems but it is unable to create the release signed one.

This means that the problem could reside in the following line:

Code: Pascal  [Select][+][-]
  1. apksigner sign --ks newapp-release.keystore --ks-pass pass:123456 --key-pass pass:123456 --out C:\LAMWProjects\newapp\build\outputs\apk\release\newapp-release.apk C:\LAMWProjects\newapp\build\outputs\apk\release\newapp-armeabi-v7a-release-unsigned-aligned.apk

Please note that, if the app is built in Ant, the signed release .apk is created correctly.

The problem could also reside in the file newapp-release.keystore which is created by executing release-keystore.bat.

My conclusion: what I need to do now is detect all of the files that come into play when release-keystore.bat and gradle-local-apksigner.bat are executed. This is because I can do everything with LAMW on my PC except sign a Gradle .apk. Presumably, the files used by release-keystore.bat and gradle-local-apksigner.bat are either missing or "outdated" on my computer so I need to reinstall them.

To jmpessoa: do you know which files are called by the two .bat files to sign the .apk?
« Last Edit: January 12, 2021, 08:50:17 pm by pasquale »
Apple loves breaking backward compatibility to make money. If you want to be sure that your apps will never stop working, use Windows and trash macOS!

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: [LAMW] How to sign a Gradle .apk
« Reply #14 on: January 12, 2021, 10:22:55 pm »

Quote
do you know which files are called by the two .bat files to sign the .apk?

Yes! You can open/edit *.bat files using Notepad...

(right-click  --> "Edit"  and by pass the security question....)
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018