Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create android code signing guide #1674

Open
DIMFLIX-OFFICIAL opened this issue Nov 11, 2023 · 4 comments
Open

Create android code signing guide #1674

DIMFLIX-OFFICIAL opened this issue Nov 11, 2023 · 4 comments
Labels
enhancement Does it add or improve content?
Milestone

Comments

@DIMFLIX-OFFICIAL
Copy link

DIMFLIX-OFFICIAL commented Nov 11, 2023

馃搵 Page(s) affected (or suggested, for new content)

https://beta.tauri.app/guides/build/

馃搵 Description or bullet point outline (if proposing new content)

The application is assembled. I am trying to install .apk on my phone, but this error occurs
pnpm Vanilla JavaScript

The APK failed to install. Error: INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vdml780192954.tmp/base.apk: Attempt to get length of null array

@FabianLars
Copy link
Member

You can only install signed apks. We don't have a guide for that yet but typically recommend flutter's guide since it's fairly close https://docs.flutter.dev/deployment/android#signing-the-app

@FabianLars FabianLars changed the title Build App Create android code signing guide Nov 18, 2023
@FabianLars FabianLars added this to the Tauri Docs 2.0 milestone Nov 18, 2023
@AdrianVispalia
Copy link

For people that have the same question, here is a link to the beta guide with the apk sign process:

https://next--tauri.netlify.app/next/guides/distribution/sign-android/

I tried it on my project and it worked. The flutter guide did give a similar outline, but given that flutter works with build.gradle and tauri works with build.gradle.kts, a code slightly different was required.

@cleveng
Copy link

cleveng commented May 16, 2024

For people that have the same question, here is a link to the beta guide with the apk sign process:

https://next--tauri.netlify.app/next/guides/distribution/sign-android/

I tried it on my project and it worked. The flutter guide did give a similar outline, but given that flutter works with build.gradle and tauri works with build.gradle.kts, a code slightly different was required.

Site Not Found

@simonhyll simonhyll added the enhancement Does it add or improve content? label May 21, 2024
@AdrianVispalia
Copy link

For people that have the same question, here is a link to the beta guide with the apk sign process:
https://next--tauri.netlify.app/next/guides/distribution/sign-android/
I tried it on my project and it worked. The flutter guide did give a similar outline, but given that flutter works with build.gradle and tauri works with build.gradle.kts, a code slightly different was required.

Site Not Found

I do not remember everything that was mentioned on that website, but I followed some steps on a project and I have:

  • created the file key.properties on /src-tauri/gen/android with the contents (change content):
storePassword=...
keyPassword=...
keyAlias=...
storeFile=storeFile.jks
  • created the file storeFile.jks following Flutter's guide and put it on /src-tauri/gen/android/app :
keytool -genkey -v -keystore ~/storeFile.jks -keyalg RSA \
        -keysize 2048 -validity 10000 -alias upload
  • modified the file build.gradle.kts on /src-tauri/gen/android/app to include the following:
val keyPropertiesFile = rootProject.file("key.properties")
val keyProperties = Properties()
keyProperties.load(FileInputStream(keyPropertiesFile))

android {
    compileSdk = 33
    namespace = "com.tauri.app"
    defaultConfig {
        manifestPlaceholders["usesCleartextTraffic"] = "false"
        applicationId = "com.tauri.app"
        minSdk = 24
        targetSdk = 33
        versionCode = 1
        versionName = "1.0"
    }
    signingConfigs {
        create("release") {
            keyAlias = keyProperties["keyAlias"] as String
            keyPassword = keyProperties["keyPassword"] as String
            storeFile = file(keyProperties["storeFile"] as String)
            storePassword = keyProperties["storePassword"] as String
        }
    }
    buildTypes {
        getByName("debug") {
            manifestPlaceholders["usesCleartextTraffic"] = "true"
            isDebuggable = true
            isJniDebuggable = true
            isMinifyEnabled = false
            packaging {                jniLibs.keepDebugSymbols.add("*/arm64-v8a/*.so")
                jniLibs.keepDebugSymbols.add("*/armeabi-v7a/*.so")
                jniLibs.keepDebugSymbols.add("*/x86/*.so")
                jniLibs.keepDebugSymbols.add("*/x86_64/*.so")
            }
        }
        getByName("release") {
            isMinifyEnabled = true
            // new
            //minifyEnabled = true
            //shrinkResources = true
            //proguardFiles(getDefaultProguardFile('proguard-android.txt'), "proguard-rules.pro")
            isShrinkResources = true

            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )

            // old
            signingConfig = signingConfigs.getByName("release")
            proguardFiles(
                *fileTree(".") { include("**/*.pro") }
                    .plus(getDefaultProguardFile("proguard-android-optimize.txt"))
                    .toList().toTypedArray()
            )
        }
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
}

I hope this helps! 馃憤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Does it add or improve content?
Projects
Status: 馃挭 Ready
Development

No branches or pull requests

5 participants