====== [hemmerling] Google Android 13/14 - App Development II ======
Related pages:
*Google Android:
*[[android.html|Android 1/14]].
*[[android02.html|Android 2/14 - Apps]].
*[[android03.html|Android 3/14 - App Development I]].
*[[android04.html|Android 4/14 - App Debugging & Testing]].
*[[android05.html|Android 5/14 - Simulators, Skins, Operating Systems, System Images]].
*[[android06.html|Android 6/14 - App Protoyping]].
*[[android07.html|Android 7/14 - App Publishing]].
*[[android08.html|Android 8/14 - Hardware]].
*[[android09.html|Android 9/14 - Amazon Fire TV]].
*[[android10.html|Android 10/14 - TV compatible Apps ( for Android TV, Google TV, Amazon Fire TV]].
*[[android11.html|Android 11/14 - Browsers & Internet Apps ( for Android TV, Google TV, Amazon Fire TV )]].
*[[android12.html|Android 12/14 - Google Android, Suggestions for Smartphone Apps to be installed on any Android Smartphone]].
*[[android14.html|Android 14/14 - App Development III]].
===== 1 Google Play Account ======
*[[http://support.google.com/googleplay/android-developer/answer/13205715|Google Support "Play-Console Hilfe" - "Website bestätigen"]].
*[[http://play.google.com/intl/de_de/about/developer-distribution-agreement.html|Google Play "Google Play – Vertriebsvereinbarung für Entwickler"]].
*[[http://play.google/intl/de/developer-content-policy/|Google Play "Richtlinienübersicht für Entwickler"]].
===== 2 Project Setup =====
*Android Studio warning: "The application name for most apps begins with an uppercase letter".
*[[http://www.thenextweb.com/news/7-common-mistakes-avoid-naming-app|TNW - The heart of tech "7 common mistakes to avoid when naming your app"]], 2016.
===== 3 Create your first App =====
*[[http://www.google.com/search?q=my+first+android+app+java|Google - Search for "my first android app java"]].
*[[http://developer.android.com/codelabs/build-your-first-android-app|Android Developer "Build Your First Android App in Java"]].
*Emulator images:
-"Motorola_g54_, [[http://www.gsmarena.com/motorola_moto_g54-12503.php|GSMArena "Motorola Moto G54"]], "1080x2400" screen resolution, "6,5 inch" display size, "2 GB" RAM, "API: 33 Tiramisu - Target: Android 13".
-"Pixel_3a_API_34_extension_level_7_x86_64", "Pixel" smartphone, "1080x2220" screen resolution.
*[[http://www.digitaltrends.com/mobile/how-to-get-developer-options-on-android/|digitaltrends "How to get developer options on your Android phone"]], 2024.
*"Einstellungen / System / Entwickleroptionen".
*"[x] Entwickleroptionen verwenden" :-).
*"[x] USB-Debugging" :-).
*[[http://www.tutorialspoint.com/xml/xml_comments.htm|TutorialsPoint "XML - Comments"]].
===== 4 App integrity =====
==== App Signing ====
*[[http://developer.android.com/studio/publish/app-signing|Android Developers "Sign your app"]].
*[[http://play.google/play-app-signing-terms/|Google Play "Nutzungsbedingungen für Play App Signing"]]
*"Sign your debug build... **Because the debug certificate is created by the build tools and is insecure by design, most app stores (including the Google Play Store) do not accept apps signed with a debug certificate for publishing**" :-(.
*[[http://play.google.com/intl/de_de/about/developer-distribution-agreement.html|Google Play "Google Play – Vertriebsvereinbarung für Entwickler"]].
*[[http://play.google/intl/de/developer-content-policy/|Google Play "Richtlinienübersicht für Entwickler"]].
==== The App Signing Process ====
=== Create a Keystore ====
*"Android Studio": "( Burger Menu ) > Build > Generate Signed Bundle/APK".
*"Android App Bundle".
*"Configure the build process to automatically sign your app"
*In the Project window, right click on your app and click "Open Module Settings".
*On the Project Structure window, under Modules in the left panel, click the module you would like to sign.
*Click on "Create new...".
*Setup "Key store path", "Key store password", "Key alias" ( default is "key0" ), "Key password".
*[[http://www.stackoverflow.com/questions/3997748/how-can-i-create-a-keystore|StackOverflow "How can I create a keystore?"]].
=== Create and Upload a Key ( An Option for Google Play, mandatory for all other Appstores ) ====
*[[http://www.stackoverflow.com/questions/44103024/how-to-enable-google-play-app-signing|StackOverflow "How to enable Google Play App Signing"]].
*Script:
java -jar pepk.jar --keystore=wrbe.jks --alias=wrbe --output=wrbe.zip --include-cert --rsa-aes-encryption --encryption-key-path=encryption_public_key.pem
*PEPK.
*Install the current "OpenJDK".
*[[http://jdk.java.net/|jdk.java.net - Production and Early-Access OpenJDK Builds, from Oracle]].
*[[http://jdk.java.net/22/|OpenJDK 22]] is ok.
*[[http://www.google.com/search?q=Cannot+find+any+provider+supporting+RSA%2FNONE%2FOAEPWithSHA1AndMGF1Padding|Google - Search for "Cannot find any provider supporting RSA/NONE/OAEPWithSHA1AndMGF1Padding"]].
*[[http://www.stackoverflow.com/questions/76516045/cannot-find-any-provider-supporting-rsa-none-oaepwithsha1andmgf1padding-when-t|StackOverflow "Cannot find any provider supporting RSA/NONE/OAEPWithSHA1AndMGF1Padding' when trying to enroll to 'Let Google Play manage your app signing key"]] - "I downloaded latest OpenJDK and the above error was resolved!". "Use Java JDK 21".
*At your [[http://play.google.com/console/developers|Google Play Developer Console]]:
*Select "Create close testing release".
*Click on "Change signing key".
*Select "Export and upload a key from Java keystore" => This works fine!
*Click on "Download encryption public key" => Download of "encryption_public_key.pem".
*Click on "Download PEPK tool" => Download of "pepk.jar".
*If you select "Export and upload a key (not using Java keystore) => This didn't works for me!
*Click on "Download encryption public key" => Download of "encryption_public_key.pem".
*[[http://www.gstatic.com/play-apps-publisher-rapid/signing-tool/prod/pepk-src.jar|pepk-src.jar]] is offered for download.
*But an exact call of PEPK with parameters is missing :-(.
*Alternative download: [[http://www.github.com/yongjhih/pepk/blob/master/README.md|GitHub "pepk / README.md"]].
*"PEPK - Play Encrypt Private Key".
*The Java codefile "[[http://www.gstatic.com/play-apps-publisher-rapid/signing-tool/prod/pepk-src.jar|pepk-src.jar]] can't be used as replacement for "pepk.jar". If you try, the error message "no main manifest attribute, in pepk-src.jar" is generated :-(.
=== The unique Option for Google Play: Play App Signing ====
*[[http://support.google.com/googleplay/android-developer/answer/9842756|Google Support, Play Console Help "Use Play App Signing"]].
=== Some extra Tools not really needed ===
*Additonal tools:
*[[http://docs.oracle.com/javase/8/docs/technotes/tools/unix/keytool.html|Oracle Java Documentation "keytool"]] is part of "OpenJDK" & "JDK".
*Script:
keytool -export -rfc -keystore hemmerling.jks -alias key0 -file hemmerling.pem
*[[http://developer.android.com/tools/apksigner|Android Developer "apksigner"]].
===== 5 Building the APK or Bundle =====
==== 5.1 ( Burger Menu ) > Build > Rebuild Project ====
*"( Burger Menu ) > Build > Select Build Variant...".
*"Build Variants:".
*"Module" = ":app"
*"Active Build Variant".
*"debug ( default )".
*"release".
*"( Burger Menu ) > Build > Rebuild Project".
*"AndroidStudioProjects\{project name}\app\build\outputs\apk\debug\app-debug.apk".
*"AndroidStudioProjects\{project name}\app\build\outputs\apk\release\app-release-unsigned.apk".
*You may either create a "debug" or a "release" item.
*One directory with the item is created. Other items in the directory are deleted.
*If the other directory exist, it is deleted.
*When building a "release" build, the "debug" directory is deleted.
*When building a "debug" build, the "release" directory is deleted.
*So you can't generate "bundle" files by this.
*So you may have just either a "debug" or a "release" item at the same time :-).
==== 5.2 ( Burger Menu ) > Build > Build Bundle(s) / APK(s) ====
*"( Burger Menu ) > Build > Select Build Variant...".
*"Build Variants:".
*"Module" = ":app"
*"Active Build Variant".
*"debug ( default )".
*"release".
*"( Burger Menu ) > Build > Build Bundle(s) / APK(s)".
*"Build APK(s)":
*"AndroidStudioProjects\{project name}\app\build\outputs\apk\debug\app-debug.apk".
*"AndroidStudioProjects\{project name}\app\build\outputs\apk\release\app-release-unsigned.apk".
*"Build Bundle(s)".
*"AndroidStudioProjects\{project name}\app\build\outputs\bundle\debug\app-debug.aab".
*"AndroidStudioProjects\{project name}\app\build\outputs\bundle\release\app-release.aab".
*You may either create a "debug" or a "release" item.
*One directory with the item is created. Other items in the directory are deleted.
*If the other directory exist, it is not deleted.
*So you may have "apk" and "bundle" directories and so "apk" and "bundle" files at the same time :-).
==== 5.3 ( Burger Menu ) > Build > Generate Signed Bundle / APK... ====
*"( Burger Menu ) > Build > Generate Signed Bundle / APK...".
*"Build APK(s)".
*"AndroidStudioProjects\{project name}\app\debug\app-debug.apk".
*"AndroidStudioProjects\{project name}\app\release\app-release.apk".
*"Build Bundle(s)"
*"AndroidStudioProjects\{project name}\app\debug\app-debug.aab".
*"AndroidStudioProjects\{project name}\app\release\app-release.aab".
*You may either create "debug" or "release" items, or "debug" and "release" items at the same time.
*One directory with the item is created. Other items in the directory are deleted.
*If one item is generated, and if the other directories exist, they are not deleted.
*So you may have "debug" and "release" directories directories at the same time :-). But you can have either "apk" and "bundle" files at the same time :-(.
==== Error Message "The Android App Bundle was not signed" ====
*See above, if you upload the wrong item as you got confused where the signed items are stored, you get the error message at upload "The Android App Bundle was not signed" :-(.
*[[http://www.stackoverflow.com/questions/17702053/where-is-android-studio-building-my-apk-file|StackOverflow "Where is android studio building my .apk file?"]], 2014 - 2024.
*[[http://www.google.com/search?q=The+Android+App+Bundle+was+not+signed|Google - Search for "The Android App Bundle was not signed"]] - No helpful results.
==== Resources ====
*[[http://developer.android.com/guide/app-bundle/|Android Developers "About Android App Bundles"]].
*From August 2021, new apps are required to publish with the Android App Bundle on Google Play. New apps larger than 200 MB are now supported by either Play Feature Delivery or Play Asset Delivery.
*You still need APKs:
*For testing by emulator and local phone. Bundle files can't be executed by that :-(.
*For upload to other APK stores than "Google Play" :-).
===== 6 Upload To Google Play for "Closed Testing" =====
==== 6.1 General Advice ====
*[[http://support.google.com/googleplay/android-developer/answer/9859152|Google Support - Google Play Console Help "Create and set up your app"]].
*[[http://developer.android.com/studio/publish/upload-bundle|Android Developers "Upload your app to the Play Console"]].
*[[http://appinventiv.com/blog/how-to-submit-app-to-google-play-store/|Appinventiv "How To Upload An App To Google Play Store?"]], 2024.
==== 6.2 Upload Warnings ====
*After upload I got the warning: "Warning. There is no deobfuscation file associated with this App Bundle. If you use obfuscated code (R8/proguard), uploading a deobfuscation file will make crashes and ANRs easier to analyse and debug. Using R8/proguard can help reduce app size".
*Error message, when NOT using "Play App Signing": "Use a valid app signing key to continue. For security reasons, the upload key must be different to the deployment key. Use a different upload certificate".
*[[http://www.google.com/searchq=use+a+valid+app+signing+key+to+continue|Google - Search for "use a valid app signing key to continue"]].
*Error message "Version code 1 has already been used. Try another version code".
*[[http://www.stackoverflow.com/questions/68057944/version-code-1-has-already-been-used-try-another-version-code|StackOverflow "Version code 1 has already been used. Try another version code"]].
*Instruction to fix in on Google Play:
-Go to the release section.
-Go to "App bundle explorer", in the top right you should see a dropdown button for you app version, click on it.
-A bottomsheet containing all the previous app bundles you uploaded will show. Delete the one with the clashing bundle version and you're good to go.
*"Adroid Studio": In the Project window, right click on your app and click "Open Module Settings".
*Tab "Default Config": By default, "Version Code" = "1".
==== 6.3 Test first! ====
*[[http://play.google.com/console/about/closed-testing/|Google Play "Closed Testing"]].
*As of 2024, you have to start with "Closed Testing" ( or "Internal testing", less interesting ). If you answered all the questions, you may upload a Bundle.
*[[http://support.google.com/googleplay/android-developer/answer/14151465|Google Support - Google Play Console Help "App testing requirements for new personal developer accounts"]].
*"These changes will require developers with personal accounts created after November 13, 2023, to meet specific testing requirements before they can make their app available on Google Play".
*"If you have a newly created personal developer account, you must run a closed test for your app with a minimum of 20 testers who have been opted-in for at least the last 14 days continuously" :-(.
*"**Open testing is available when you have production access**" :-(.
*Is this a solution?
*Create 20 virtual smartphones on a multi-instance Android emulator ( e.g. "BlueStacks Multi-Instance" ), on your desktop PC, or even in the Cloud. Note that it is not necessary for "opt-in", that more than one smartphone is active, at a time :-).
*Create 20 fresh new E-Mail adresses ( e.g. "Emailn.de" ), which refer hsto a single true long-time existing E-Mail address. E-Mail verification works fine. Some free E-Mail providers ( e.g. "Emailn.de" ) just accept a new E-Mail registration from the same IP address, after 24h. Or you must change your IP adress by router reset to get more E-Mail addresses in short time.
*Create "Google" accounts & login to "Google Play".
*2 actions:
-Open 20 "Google" accounts, with these fresh new non-Google E-Mail addresses. E-Mail verification is provided.
-Login to "Google Play" on the 20 virtual smartphones, with the "Google" accounts.
*After the first or at least after the second action, Google ask nowadays usually for a verification by sending a code over a second communications channel, e.g. by an **automatic audio call to a landline telephone** or mobile telphone, or sending an SMS to a mobile telephone: "We've detected unusal activity on this account. Enter a phone number to get a verification code by text message".
*Error message, after I tried to use a telephone number the second time for verification: "This phone number has already been used too many times for verification" :-(.
*The app is not available at "Google Play". It might be installed by local APK side-installation, or by another app-store.
*So how do the testers cause an "opt-in" to be recognized by Google?
*Must the testers have a "Google" account, must they login at "Google Play"?
*Testers.
*How to send an invitation for download of a new app release to testers? How to communicate with the testers?
*"Closed Testing", "Internal Testing": By E-Mail - Howto??? Must I collect the E-Mail addresses from "Google Play" and send manually an E-Mail?
*"Closed Testing": By Google Groups - Simple, by group message within "Google Groups", not with "Google Play".
*[[http://www.streak.com/post/how-many-gmail-accounts-can-you-have|Streak "How many Gmail accounts can I have?"]] - "You’ll be limited to four total Gmail accounts linked to the same phone number".
*[[http://sms-man.com/blog/how-to-create-a-google-play-account-without-phone-number/|SMS-Man "How to create a Google play account without phone number"]].
*[[http://www.google.com/search?q=google+play+account+without+mobile+number|Google - Search for "google play account without mobile number"]].
*[[http://www.google.com/search?q=google+play+20+testers+howto|Google - Search for "google play 20 testers howto"]].
*[[http://support.google.com/accounts/answer/114129?|Google Support "Verify your account"]].
*"'This phone number cannot be used for verification'. If you find this error message, you have to use a different number. To protect you from abuse, we limit the number of accounts each phone number can create" :-(.
==== 6.4 Production Release ====
*[[http://support.google.com/googleplay/android-developer/answer/9859348|Google Support, Play Console Help "Prepare and roll out a release"]]
*"Google Play":
*"Dashboard".
*"Update status: Ready to send for review. Go to publishing overview".
*"Release Overview" page:
*"Production: Active".
*"Release Status: Full roll-out" ( might be "Available on Google Play" ).
*"Publishing overview".
*"Managed publishing. Managed publishing off. When you send your changes to Google for review, they'll be published automatically as soon as they're approved".
*General warning, not if just e.g "Germany" is target, and not all EU countries:
*"Geo-blocking regulation. If you're distributing apps in the EU, see Geo-blocking Regulation (EU) 2018/302".
*[[http://support.google.com/googleplay/android-developer/answer/6223646|Google Support, Google Play Console "Requirements for distributing apps in specific countries/regions"]].
*However, there is no easy "All EU Countries" country selection :-(.
*"Changes ready to send for review".
*Open a fresh request for review.
*Google states in a standard message that a review may take 7 days ( TODO: Copy the original message to here ).
*Add additional changes to the current request for review.
*Blue button "Send 1 change for review".
*"Add 1 change to current review? These changes will be reviewed at the same time as changes that have already been sent for review. This may increase the review time".
*With a review for an app, all "Google Play" data changes for that app are reviewed. I.e. there so separate review for changes in "Production" or "Closed Testing", nor just review of a new app release. By consequence, if you change anything on "Google Play", this causes a change which must be reviewed by Google, if you release a new app version for any category, i.e. for "Production", "Closed Testing", "Internal Testing".
*Adding E-Mail addresses of testers to the mailing lists for "Closed Testing" & "Internal Testing" is not a change :-).
*Store photos:
*"Chromebook: Image must have an aspect ratio of 16:9 and a width between 1920 px and 7680 px".
*[[http://www.quora.com/How-long-does-it-take-for-an-app-to-reflect-in-Play-Store-after-the-app-status-shows-as-in-production-in-Google-play-console|Quora "How long does it take for an app to reflect in Play Store after the app status shows as ‘in production’ in Google play console?"]].
{{tag>"Google Android" Android}}