小编use*_*949的帖子

Camera2 API 与 Google Play 商店的兼容性问题


我开发了一个使用camera2 API 的android 应用程序。调试时,我可以在自己的物理设备上运行此应用程序,但是当我尝试将应用程序发布到 Google Play 商店时,它说我的设备不兼容 - 事实上,没有任何设备与此兼容我的应用程序。

我一直在与谷歌支持联系,他们说“由于缺少以下设备功能,您的应用程序清单中存在冲突,您的应用程序与大多数设备不兼容:android.hardware.camera2。”

我注意到我的 gradle 文件中的 min-sdk 版本设置为 15。
所以我的问题是:如果我将 min-sdk 版本更改为 21,我的应用程序是否会与我的设备兼容,或者我是否需要重写我的整个代码以使用已弃用的相机 API 代替?

提前致谢。

*编辑:
这是我的android清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="...">
<uses-feature
    android:name="android.hardware.camera2"
    android:required="true"/>

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

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:name=".app.AppController"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <meta-data
        android:name="com.google.android.gms.vision.DEPENDENCIES"
        android:value="barcode"/>

    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar"
        android:screenOrientation="portrait">

    </activity>

    <activity
        android:name=".ResultsActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar"
        android:screenOrientation="portrait">

    </activity>

    <activity
        android:name=".QRScanner"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>
Run Code Online (Sandbox Code Playgroud)

android google-play

4
推荐指数
1
解决办法
1362
查看次数

How do I use a non-final variable in a Android View's onClickListener?

I got some problems with some of my code. Basiclly, it's a countdown program, but whenever a button is clicked, it should refresh the countdown. I hope that makes sense. Below is some of my code, however, it's not working as intended.

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    final TextView mTextField = (TextView) findViewById(R.id.mTextField);
    final Button refresh = (Button) findViewById(R.id.button1);
    final int j = 30000;
    int i = j;
    refresh.setOnClickListener(new View.OnClickListener() { …
Run Code Online (Sandbox Code Playgroud)

android

3
推荐指数
1
解决办法
4278
查看次数

标签 统计

android ×2

google-play ×1