我在 android 上创建了应用程序,主要目标是:用户使用他的 Google 帐户登录,扫描 NFC 标签,使用 volley 库将用户登录和标签信息发送到服务器并获得响应。当我使用 Android Studio 和 USB 调试时,一切正常,一切正常。我已将该应用程序放到 google play 商店,但它与我的 p9 lite 或任何其他带 NFC 的手机不兼容。所以我什至不能下载应用程序。这是来自 Google Play 的屏幕截图:
这是我的 Android list :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="some.package.name">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-feature android:name="android.nfc"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<meta-data
android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/nfc_tech_filter" />
</activity>
</application>
</manifest>
这也是我的 gradle 构建项目:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
和 gradle 构建应用程序:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'key0'
storeFile file('C:/AndroidKey/RandomKey.jks')
keyPassword 'randomKey'
storePassword 'randomPassword'
}
}
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "someId"
minSdkVersion 15
targetSdkVersion 25
versionCode 3
versionName "1.02"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
debug {
signingConfig signingConfigs.config
}
}
}
dependencies {
compile 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3'
compile 'com.android.volley:volley:1.0.0'
compile 'com.yarolegovich:lovely-dialog:1.0.5'
compile 'hanks.xyz:htextview-library:0.1.5'
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-auth:9.8.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
通过 USB 连接一切正常,但我什至无法从 Google Play 商店下载应用程序。在这种情况下我能做什么?谢谢和问候。
编辑:
我已更改
<uses-feature android:name="android.nfc"/>
至<uses-feature android:name="android.hardware.nfc"/>
但还是一样的情况:编辑:我的设备有 NFC,当我单击选项以显示我的应用程序的兼容设备时,它就在那里。
最佳答案
正确的标签是
<uses-feature android:name="android.hardware.nfc"/>
如果您的应用也可以在没有 NFC 芯片的设备上运行,您应该添加
android:required="false"
到上面的标签。
关于Android 应用程序与我的设备不兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43332762/