2016-08-06 119 views
-1

背景:我試圖與RxPermissions簡單..我創建了波紋管代碼/設置一個新的項目,但是當我啓動應用程序,我得到了與該消息的對話框「不幸的是包安裝程序已停止」不幸的是包安裝已停止

gradle.build

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:24.1.1' 
    compile 'com.tbruyelle.rxpermissions:rxpermissions:[email protected]' 


    compile 'io.reactivex:rxandroid:1.2.1' 
    // Because RxAndroid releases are few and far between, it is recommended you also 
    // explicitly depend on RxJava's latest version for bug fixes and new features. 
    compile 'io.reactivex:rxjava:1.1.6' 

} 

MainActivity.java

public class MainActivity extends Activity { 

    @Override protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 

    // Must be done during an initialization phase like onCreate 
    ((Button) findViewById(R.id.button)).setOnClickListener(new View.OnClickListener() { 
     @Override public void onClick(View view) { 
     RxPermissions.getInstance(MainActivity.this) 
      .request(Manifest.permission.CAMERA) 
      .subscribe(new Action1<Boolean>() { 
       @Override public void call(Boolean aBoolean) { 

       } 
      }); 
     } 
    }); 


    } 
} 
+0

你使用的是哪個版本的Android Studio? logcat中沒有任何內容? – jonathanrz

+0

我使用Android Studio 2.1.2 – Abdellah

+0

我不認爲這是一個AS版本的問題,因爲我使用相同版本運行RxPermissions示例,但沒有此問題 – Abdellah

回答

1

我忘了在清單中聲明權限Manifest.permission.CAMERA

+0

但現在彈出權限不顯示? –