【发布时间】:2015-12-06 15:12:40
【问题描述】:
我在使用 Android Studio 时遇到了一个错误,这让我非常生气。我有一个带有显示标记的谷歌地图的应用程序。一切都运行良好,但后来我添加了一个自定义标记视图,以便以更好的方式显示信息,当我在我的设备上重新安装应用程序时,它开始给我这个错误:
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.rioma.mapaclientescercanos/.ActivityMaps } Error type 3 Error: Activity class {com.rioma.mapaclientescercanos/com.rioma.mapaclientescercanos.ActivityMaps} does not exist.
问题是应用程序安装正确,但似乎没有找到运行它的主要活动。我还有另一个应用程序,我正在尝试通过 Intent 启动这个应用程序,并且以前可以使用,但现在不是。 我已经检查了与包名称、应用程序 ID 有关的所有内容,尝试重命名包,将项目复制到另一个新项目,但它根本不起作用。我第一次安装应用程序时它会正确启动,但第二次安装时出现错误。即使第一次尝试从其他应用程序启动它也不起作用。删除自定义标记视图没有帮助。 我已经尝试过这里发布的一些解决方案,例如this one 和this other,但没有一个可行。还尝试更改 compileSdk、targetSdk 和 buildTools 版本,但没有结果。
发布我的清单和 gradle.build:
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.rioma.mapaclientescercanos.ActivityMaps"
android:label="asd" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-feature android:glEsVersion="0x00020000"
android:required="true"/>
Gradle.build:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
applicationId 'com.rioma.mapaclientescercanos'
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-v4:23.0.0'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.google.maps:google-maps-services:0.1.7'
compile files('libs/jtds-1.2.8.jar')
}
希望你能帮助我,因为我工作需要这个。
编辑:
好的,我发现问题与这段代码有关:
PackageManager p = getPackageManager();
ComponentName componentName = new ComponentName(this, ActivityMaps.class);
p.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP );
我需要这个应用程序不要出现在应用程序抽屉中,所以我添加了这个代码。当我在没有此代码的情况下重新安装时,它运行良好,但在我添加它的那一刻,错误就出现了。我将检查是否有另一种方法可以将应用程序图标隐藏在抽屉中。它可能与此特定代码有关,可能隐藏包名称或其他东西。
【问题讨论】:
-
将此行 android:name="com.rioma.mapaclientescercanos.ActivityMaps" 更改为 android:name=".ActivityMaps"
-
还有清单文件包名是 package="com.rioma.mapaclientescercanos" >
-
我需要这个应用程序不要出现在应用程序抽屉中什么是应用程序抽屉?
-
@TimCastelijns 应用程序抽屉是显示所有已安装应用程序的菜单
-
我也遇到了这个问题,我用this solution解决了这个问题
标签: java android google-maps android-intent android-studio