2016-06-21 1 views
3

Hello World를 TextView 요소에만 삽입하는 Hello World 앱을 만들 때 앱은 "휴대 전화 상태 및 ID 읽기"및 " SD 카드 내용 수정 및 삭제 "를 참조하십시오. 어느 곳에서나 프로젝트 폴더 전체를 재귀 적으로 grepping 할 수는 없습니다.내가 컴파일 한 모든 Android 앱은 Hello World 앱에 대해서도 일부 권한을 묻습니다.

사람들이 무작위 권한을 요청하는 앱에 대해 불평하는 다양한 스레드가 있으며 라이브러리 종속성이이를 사용합니다. 나는 어떤 도서관도 사용하지 않는다. 내 수입품은 android.app.Activity, android.widget.TextViewandroid.os.Bundle입니다. 내 AndroidManifest.xml이 포함

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
     package="helloworld.test" 
     android:versionCode="1" 
     android:versionName="1.0"> 
    <application android:label="@string/app_name"> 
     <activity android:name="helloactivity" 
        android:label="@string/app_name"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
    </application> 
</manifest> 

참고 아무런 <uses-permission ... 없습니다. libs 폴더가 비어 있습니다. res 폴더에는 정확히 xml 파일이있는 두 개의 폴더가 포함됩니다. 하나는 레이아웃 (LinearLayoutTextView 요소 포함)입니다. 다른 하나는 애플리케이션 이름과 함께 values/strings.xml입니다.

마지막으로 .apk 파일을 검사하여 AndroidManifest.xml 파일 (일부 사용자 지정 바이너리 형식으로 컴파일 됨)을 디코딩했으며 원본과 동일합니다. 컴파일 중에는 아무 것도 추가하지 않습니다.

두 개의 Android 4.4 기기와 5.1 기기로 테스트 할 수있는 모든 기기에서 권한이 요청됩니다.

편집 : Why is my app asking for phone id permission?

내가 API 레벨 19 ~ 그 뭔가 될 수 있을까 ~~ 편집이 대상 해요 : : 결코 마음, 수준에 대해 컴파일 (23)이 더하게 좀 더 둘러보고,이 같은 소리 차이점/편집 2. 나는 (유명한 손전등 응용 프로그램 예) 권한을 요청하는 응용 프로그램을 정말 싫어하지만, 물론 오래된 전화에서도 실행되도록합니다.

댓글에 대한 응답으로 프로젝트는 gradle을 사용하지만 개미는 사용하지 않습니다.

<?xml version="1.0" encoding="UTF-8"?> 
    <project name="helloworld" default="help"> 
    <property file="local.properties" /> 
    <property file="ant.properties" /> 
    <property environment="env" /> 
    <condition property="sdk.dir" value="${env.ANDROID_HOME}"> 
     <isset property="env.ANDROID_HOME" /> 
    </condition> 
    <loadproperties srcFile="project.properties" /> 
    <fail message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable." unless="sdk.dir" /> 
    <import file="custom_rules.xml" optional="true" /> 
    <import file="${sdk.dir}/tools/ant/build.xml" /> 
</project> 

그리고 마지막으로 자바 코드 : : 그것은 아니었다 중요 최소 SDK 버전을, 밝혀졌다

package helloworld.test; 

import android.app.Activity; 
import android.widget.TextView; 
import android.os.Bundle; 

public class skeletonactivity extends Activity 
{ 
    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) 
    { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 
     TextView out = (TextView) findViewById(R.id.output); 
     out.setText("Hello World."); 
    } 
} 
+0

활동 코드와 build.gradle을 게시하십시오. – earthw0rmjim

+0

@ user13 완료.감사합니다 – Luc

+0

애플 리케이션이 요구하는 권한은 무엇입니까? 또한 build.gradle 대신 build.xml이 필요한 이유를 모르겠습니다. Android Studio를 사용하지 않습니까? – Akshay

답변

2

이 의견을 박탈 build.xml 파일입니다 심지어 android create project에 의해 생성 된 속성. target=android-19 (또는 프로젝트 작성 명령에서 지정한 대상)을 포함하는 project.properties 파일을 생성했습니다. 이 줄은 오른쪽 <manifest ...>에 해당되는 귀하의 <application> 태그의 외부 그래서 가 자동으로 버전 1을 기본값으로, minSdkVersion없이

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

다음 AndroidManifest.xml 당신이 해야에서

이 같은 라인을 가지고 .

이러한 특정 사용 권한의 경우 API 레벨 4가 필요합니다. minSdkVersion 3을 사용할 때 여전히 사용 권한을 묻습니다.

+0

당신은 당신 자신의 대답을 수락 할 수있다/대답해야한다. – barlop

+0

@barlop 아, 네가 "너는 2 일 만에 너의 대답을 받아 들일 수있다"고 말해서 잊어 버렸다. – Luc