React Native应用仅允许Google Play商店中的410个设备

栏目: 十大 · 发布时间: 2021-04-13

简介  这篇文章主要介绍了React Native应用仅允许Google Play商店中的410个设备以及相关的经验技巧,文章约4596字,浏览量410,点赞数5,值得参考!

我在Google Play商店遇到问题,该商店坚持认为我的应用程序受410个设备支持。我在Google上传了app-x86-release.apk,它显示了支持的Android设备410设备。我尝试过在社区和其他地方找到的所有解决方案,但没有运气

AndroidManifest.xml: -

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.animatedapp"
    android:versionCode="12"
    android:versionName="1.0">

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="26" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

    <uses-feature android:name="android.hardware.faketouch" android:required="true" />

    <application
      android:name=".MainApplication"
      android:allowBackup="true"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>                 
</manifest>

和build.gradle: -

apply plugin: "com.android.application"

import com.android.build.OutputFile



apply from: "../../node_modules/react-native/react.gradle"


def enableSeparateBuildPerCPUArchitecture = true


def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.3"

    defaultConfig {
        applicationId "com.animatedapp"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 14
        versionName "1.6"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }

       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"
        }
    }
    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]
            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 {
    compile project(':react-native-custom-tabs')
    compile project(':react-native-cookie')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules     
    compile "com.android.support:appcompat-v7:25.0.1"
    compile project(':ReactNativeChromeCustomTabs')
    compile project(':RNWebView')
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}
答案

我猜那是因为你上传了“app-x86-release.apk”,它是用于x86架构的APK。 Google Play控制台向我展示了大约400个带有x86 arch的设备。

从您的gradle文件:

include "armeabi-v7a", "x86"

您的应用程序支持armeabi-v7a架构,也可以上传此版本。


以上就是本文的全部内容,希望对大家的学习有所帮助,版权归原作者或者来源机构所有,感谢作者,如果未能解决你的问题,请参考以下文章。

App被杀死时的回调-React Native

React Native 技术 开发跨平台 Native App 初探(示例代码)

React Native:使用 JavaScript 构建原生应用 详细剖析(示例代码)

React Native Android生成已签名的APK

react-native在Anroid真机运行时可能会遇到白屏的情况解决办法