2014-10-10 143 views
1

嗨,希望有人能帮助,Android的 - 应用程序未安装

我在做一门课程,他们正在对Android权限考验我们和我们目前的任务是有2个包,一它可以调用其他包,我将称这些为“呼叫包”和“被叫包”。

调用程序包没有什么特别之处,这是一个非常简单的方法,它只加载一个非常简单的布局文件,因此所有的权限调整都在Manifest文件中完成。

我的问题是, a)我的呼叫应用程序似乎工作正常,即它调用被调用的应用程序,一切似乎工作正常。 b)然而,如果我尝试直接从加载到仿真器或实际设备上的应用程序启动我的调用应用程序,我会收到一条消息,指出“应用程序未安装”,LogCat中没有任何内容出现

因此,我为被调用的应用程序包含了清单文件,您会发现// TODO部分,其中的代码从我提供的文件中移走。

我对你的兴趣感谢,这里的调用应用程序的清单文件,该文件是在错误必须是:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="course.labs.dangerousapp" 
    android:versionCode="1" 
    android:versionName="1.0" > 

<uses-sdk 
    android:minSdkVersion="13" 
    android:targetSdkVersion="19" /> 

<!-- 
     TODO - Using a permission element, 
     define a custom permission with name 
      "course.labs.permissions.DANGEROUS_ACTIVITY_PERM" 
     and "dangerous" protection level. 
--> 
<permission 
    android:name="course.labs.permissions.DANGEROUS_ACTIVITY_PERM" 
    android:description="@string/permission_description" 
    android:label="@string/permission_label" 
    android:protectionLevel="dangerous" > 
</permission> 

<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 

    <!-- TODO - enforce the custom permission on this Activity --> 

    <activity 
     android:name=".DangerousActivity" 
     android:label="@string/app_name" 
     android:permission="course.labs.permissions.DANGEROUS_ACTIVITY_PERM" > 

     <!-- 
      TODO - add additional intent filter info so that this Activity 
       will respond to an Implicit Intent with the action 
       "course.labs.permissions.DANGEROUS_ACTIVITY" 
     --> 

     <intent-filter> 
      <action android:name="course.labs.permissions.DANGEROUS_ACTIVITY" /> 

      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

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

回答

3

MainActivity无法通过主屏幕启动开始,因为在主屏幕上做不保留course.labs.permissions.DANGEROUS_ACTIVITY_PERM权限,并且您正在使用该权限为该活动辩护。

+0

太好了,非常感谢,这意味着我需要为intent-filter添加额外的内容吗? – 2014-10-10 16:50:00

+0

@RogerW:不,这意味着你必须从'MAIN' /'LAUNCHER'活动中删除该权限。要么有单独的'LAUNCHER'活动,要么完全删除权限。 – CommonsWare 2014-10-10 16:50:51

+0

非常感谢@CommonsWare先生,非常感谢。 – 2014-10-10 16:52:36