-3

H:\android\projects\FileTracker\app\src\main\java\com\example\filetracker\ApproveActivity.java Error:(169, 28) error: cannot find symbol method shouldShowRequestPermissionRationale(ApproveActivity,String) Error:(179, 28) error: cannot find symbol method requestPermissions(ApproveActivity,String[],int) Error:(349, 1) error: method does not override or implement a method from a supertype Error:Execution failed for task ':app:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

java file (ApproveActivity.java)

public void EnableRuntimePermissionToAccessCamera()
 {

        if (ActivityCompat.shouldShowRequestPermissionRationale(ApproveActivity.this,Manifest.permission.CAMERA))
        {

            // Printing toast message after enabling runtime permission.
            Toast.makeText(ApproveActivity.this,"CAMERA permission allows us to Access CAMERA app", Toast.LENGTH_LONG).show();

        }
        else
        {

            ActivityCompat.requestPermissions(ApproveActivity.this,new String[]{Manifest.permission.CAMERA}, RequestPermissionCode);

        }
 }

build.gradle(Module.app)

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "26.0.0"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:19.1.0'
    compile 'com.android.support:appcompat-v7:19.1.0'
}
  • 3
    Please don't post screenshots of code, XML, or logcat output. Please post all text as text. – Mike M. Aug 11 '17 at 09:38
  • code added....now plz help me... – Bodakiya Vishal Aug 11 '17 at 10:05
  • Your support library versions are _way_ out of date. You need to use at least 23.0.0 for the runtime permissions stuff. – Mike M. Aug 11 '17 at 10:09
  • getting this type of errors after upgrading to 23.0.0 – Bodakiya Vishal Aug 11 '17 at 10:22
  • Error:(8, 23) error: package org.apache.http does not exist Error:(9, 23) error: package org.apache.http does not exist Error:(10, 23) error: package org.apache.http does not exist Error:(11, 30) error: package org.apache.http.client does not exist Error:(12, 37) error: package org.apache.http.client.entity does not exist Error:(13, 38) error: package org.apache.http.client.methods does not exist Error:(14, 35) error: package org.apache.http.impl.client does not exist Error:(15, 31) error: package org.apache.http.message does not exist – Bodakiya Vishal Aug 11 '17 at 10:22
  • https://stackoverflow.com/questions/31433687/android-gradle-apache-httpclient-does-not-exist, https://stackoverflow.com/questions/32295994/android-package-org-apache-http-does-not-exist-sdk-23, https://stackoverflow.com/questions/32071025/apache-http-connection-with-android-6-0-marshmallow – Mike M. Aug 11 '17 at 10:26

1 Answers1

-1

Import this in your project;

import android.support.v4.app.ActivityCompat;
Vishal Vaishnav
  • 3,346
  • 3
  • 26
  • 57