Android: 可以安装apk但打不开(打开灰显)
Android: Can install apk but can't open (open greyed out)
我正在创建我的第一个 android 应用程序。我可以通过 ADB 在 phone (Android 6.1) 上从 android studio 运行 正常使用它,但是在未连接到计算机时我完全无法访问它。
如果我手动安装 apk,应用程序安装正常,但 "Open" 按钮在安装结束时变灰。该应用程序也没有出现在我的应用程序抽奖中,但确实出现在我安装的设置下的应用程序中。
有人有什么建议吗?
这是我的 android 清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.domain.mediasyncer">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:enabled="true"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="oauthresponse"
android:scheme="mediasyncer" />
</intent-filter>
</activity>
<activity
android:name=".ShowActivity"
android:label="@string/title_activity_show"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".SeasonActivity"
android:label="@string/title_activity_season"
android:theme="@style/AppTheme.NoActionBar" />
</application>
</manifest>
编辑:我能够安装来自未知来源的 apk。
似乎删除以下内容可以让我打开应用程序。有什么建议我可以将其包含在我的意图中并仍然打开我的应用程序吗?
<data android:host="oauthresponse" android:scheme="mediasyncer" />
从此处复制: 稍作改编
由于 intent-filter matching/resolution 进程,当 Android "shows the applications" 在启动器中时,它会使用匹配机制显示列表,而当您添加应用程序时则不会匹配,因为系统在显示启动器时没有带任何数据。
解决方案是创建另一个 intent-filter,例如:
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:enabled="true"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="oauthresponse"
android:scheme="mediasyncer" />
</intent-filter>
</activity>
我正在创建我的第一个 android 应用程序。我可以通过 ADB 在 phone (Android 6.1) 上从 android studio 运行 正常使用它,但是在未连接到计算机时我完全无法访问它。
如果我手动安装 apk,应用程序安装正常,但 "Open" 按钮在安装结束时变灰。该应用程序也没有出现在我的应用程序抽奖中,但确实出现在我安装的设置下的应用程序中。
有人有什么建议吗?
这是我的 android 清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.domain.mediasyncer">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:enabled="true"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="oauthresponse"
android:scheme="mediasyncer" />
</intent-filter>
</activity>
<activity
android:name=".ShowActivity"
android:label="@string/title_activity_show"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".SeasonActivity"
android:label="@string/title_activity_season"
android:theme="@style/AppTheme.NoActionBar" />
</application>
</manifest>
编辑:我能够安装来自未知来源的 apk。
似乎删除以下内容可以让我打开应用程序。有什么建议我可以将其包含在我的意图中并仍然打开我的应用程序吗?
<data android:host="oauthresponse" android:scheme="mediasyncer" />
从此处复制:
由于 intent-filter matching/resolution 进程,当 Android "shows the applications" 在启动器中时,它会使用匹配机制显示列表,而当您添加应用程序时则不会匹配,因为系统在显示启动器时没有带任何数据。
解决方案是创建另一个 intent-filter,例如:
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:enabled="true"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="oauthresponse"
android:scheme="mediasyncer" />
</intent-filter>
</activity>