mikehardy/jetifier

cannot create app shortcut

januarsmad opened this issue · 3 comments

i'm currently using RN v.0.59.6, already migrate my project to androidx and so i'm using jetifier. after trying to installDebug by running it with npx react-native run-android, it did success and the aps run just fine. But i found out that there's no app shortcut created on the device.
Then i try to assembleRelease my aps, uploaded to apphost, installed it and the result is the same.
Anyone knows how to fix this?

Thank's for every reply.

Here's my project settings
Android Gradle Plugin Version: 3.4.2
Gradle Version: 5.1.1

android/app/build.gradle

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'
    }
}

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
apply from: "../../node_modules/react-native-sentry/sentry.gradle"

def enableSeparateBuildPerCPUArchitecture = true
def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    defaultConfig {
        applicationId "com.xx"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 6
        versionName "0.52.0"
        missingDimensionStrategy 'react-native-camera', 'general'
        multiDexEnabled true
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    implementation project(':@react-native-firebase_app')
    implementation project(':@react-native-firebase_analytics')
    implementation project(':react-native-appsflyer')
    implementation project(':react-native-code-push')
    implementation project(':react-native-device-info')
    implementation project(':react-native-sentry')
    implementation project(':react-native-image-picker')
    implementation project(':react-native-fbsdk')
    implementation project(':react-native-google-signin')
    implementation project(':react-native-onesignal')
    implementation project(':react-native-svg')
    implementation project(':react-native-camera')
    implementation project(':react-native-vector-icons')
    implementation (project(':react-native-maps')){
        exclude group: 'com.google.android.gms', module: 'play-services-base'
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'com.android.support:multidex:1.0.0'
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.google.android.gms:play-services-auth:${rootProject.ext.googlePlayServicesAuthVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation "com.facebook.fresco:animated-gif:1.10.0"
    implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
    implementation "com.google.android.gms:play-services-base:16.0.0"
    implementation "com.google.android.gms:play-services-maps:16.0.0"
    implementation "com.google.android.gms:play-services-gcm:16.0.0"
    implementation "com.google.android.gms:play-services-location:16.0.0"
    implementation "com.google.firebase:firebase-core:16.0.9"
}

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply plugin: 'com.google.gms.google-services'

android/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
        googlePlayServicesAuthVersion = "16.0.1"
    }
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'com.google.gms:google-services:4.1.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenLocal()
        maven {
          url 'https://maven.google.com'
          name 'Google'
        }
        jcenter()
        maven {
          url "https://jitpack.io"
        }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

my project dependencies

"dependencies": {
    "@react-native-firebase/analytics": "^6.0.3",
    "@react-native-firebase/app": "^6.0.3",
    "immutable": "3.8.2",
    "moment": "^2.24.0",
    "react": "16.8.3",
    "react-native": "^0.59.6",
    "react-native-appsflyer": "^1.4.5",
    "react-native-calendars": "^1.208.0",
    "react-native-camera": "^2.6.0",
    "react-native-code-push": "^5.6.1",
    "react-native-countdown-component": "^2.6.0",
    "react-native-device-info": "^2.3.2",
    "react-native-fbsdk": "^0.8.0",
    "react-native-google-maps": "^1.0.0",
    "react-native-google-places-autocomplete": "^1.3.9",
    "react-native-google-signin": "^2.0.0",
    "react-native-image-picker": "^0.28.1",
    "react-native-keyboard-aware-scroll-view": "^0.8.0",
    "react-native-maps": "^0.24.2",
    "react-native-modal-datetime-picker": "^7.4.2",
    "react-native-onesignal": "^3.2.12",
    "react-native-progress": "^3.6.0",
    "react-native-router-flux": "^4.0.6",
    "react-native-sentry": "^0.43.2",
    "react-native-svg": "^9.4.0",
    "react-native-svg-charts": "^5.2.0",
    "react-native-vector-icons": "^6.4.2",
    "react-redux": "^7.0.2",
    "redux": "^4.0.1",
    "redux-persist": "^5.10.0",
    "redux-thunk": "^2.3.0",
    "victory-native": "^32.0.2"
  },

This has nothing to do with jetifier.

thank you @mikehardy

I will mention that as far as I know the only way to get a shortcut automatically is to have it installed by the default package manager from the play store. There are other ways to install shortcuts but none of them are very good at all, as they result in odd looking shortcuts and require user permission when you try to create it. Basically, you get a shortcut if you install from the Play Store, and you don't otherwise. Still nothing to do with jetifier though :-). Good luck