2014-10-10 146 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