gpt4 book ai didi

android - 应用无法在具有更高API的测试设备上启动

转载 作者:行者123 更新时间:2023-12-03 17:06:40 26 4
gpt4 key购买 nike

我有一个可以在测试设备(API 17)上正常运行的android应用。但是,当我在具有更高API(在这种情况下为22)的设备上运行同一应用程序时,该应用程序无法启动。

所有这些设备都是真实的设备而不是模拟器

    02/19 11:10:07: Launching app
$ adb shell am start -n "com.example.user.eafya/com.example.user.eafya.activities.FirstActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n
"com.example.user.eafya/com.example.user.eafya.activities.FirstActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.user.eafya/.activities.FirstActivity }
Error type 3
Error: Activity class {com.example.user.eafya/com.example.user.eafya.activities.FirstActivity} does not exist.

Error while Launching activity

第一个 Activity 是 list 文件中的启动器 Activity 。

这是 build.gradle文件
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.user.eafya"
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
resValue "string", "google_maps_key", (project.findProperty("GOOGLE_MAPS_API_KEY") ?: "")
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:multidex:1.0.1'
implementation 'com.android.support:support-v4:26.1.0'
compile 'com.google.android.gms:play-services:11.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation files('libs/gson-2.8.2.jar')
implementation files('libs/okhttp-3.0.0-RC1.jar')
}
repositories {
mavenCentral()
}

apply plugin: 'kotlin-android-extensions'

list
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.user.eafya">

<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
android:name=".activities.AppController"
android:allowBackup="true"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".activities.MainActivity" />
<activity android:name=".activities.FirstActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.RegisterActivity"
android:label="Register" />
<activity
android:name=".activities.ClinicalHistory"
android:label="LOG IN" />
<activity
android:name=".activities.LoginActivity"
android:label="LOG IN" />
<activity android:name=".activities.AddAllergy" />
<activity
android:name=".activities.ClinicalHistoryDetailActivity"
android:label="LOG IN" />
<activity android:name=".activities.Appointments" />
<activity
android:name=".activities.Allergies"
android:label="@string/title_activity_allergies"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".activities.MedicalTips"
android:label="News" />
<activity android:name=".activities.MedicalDetailActivity" />
<activity android:name=".activities.Wallet" />

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />

<activity
android:name=".activities.MapsActivityCurrentPlace"
android:label="@string/title_activity_maps" />
<activity android:name=".activities.AddChronics" />
<activity android:name=".activities.AllergyDetail"></activity>
</application>

</manifest>

最佳答案

谢谢大家的贡献。这是我发现的。我将启动器 Activity 更改为“FirstActivity”以外的另一个 Activity ,该 Activity 也失败了,但至少它给了我一个错误:

java.lang.RuntimeException: A TaskDescription's primary color should be opaque

将原色(使用位于colors.xml的颜色托盘)更改为完全不透明后,一切正常。

我已经调整了primary和primaryDark的透明度,这似乎已经成为问题。

关于android - 应用无法在具有更高API的测试设备上启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48861968/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com