PermissionsDispatcher: Auto generated class is not generating

Overview

  • Hello, thanks for great simple library. I couldn’t afford to run this library at my project. Everything okey except generation step, I’ve added plugin, library and another steps but method didn’t work 😦 My expected generated classes are never come 😢 :'/

Environment

  • I’m using AS 2.3.2 and your library 2.3.1 version

Reproducible steps

Here is my app.gradle


apply plugin: 'com.android.application'
apply plugin: 'android-apt'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId "com.okeyoo.com"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 5
        versionName "1.3.1"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile('com.github.worker8:tourguide:1.0.16-SNAPSHOT@aar') {
        transitive = true
    }
    compile 'ly.count.android:sdk:15.08'
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.google.android.gms:play-services-ads:10.0.1'
    compile 'com.google.android.gms:play-services-auth:10.0.1'
    compile 'com.google.android.gms:play-services-gcm:10.0.1'
    compile 'com.github.hotchemi:permissionsdispatcher:2.3.1'
    apt 'com.github.hotchemi:permissionsdispatcher-processor:2.3.1'
}

project.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven(){
            url "https://oss.sonatype.org/content/repositories/snapshots"

        }

        maven {
            url  "http://dl.bintray.com/countly/maven"
        }


    }
}

Here my code sample java class

@RuntimePermissions
public class ResultActvity extends Activity {

    TextView mStartPoint, mFinishPoint, mDistance, mFuelCost, mFuelConsumpt, mPrice, mDateTime, mWarning, mResult;
    ImageButton mShareButton;

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

       
        mShareButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
            /*    Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
                sharingIntent.setType("text/plain");
                String shareBody = "Uygulama çok güzel";
                sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Uygulama hakkında");
                sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
                startActivity(Intent.createChooser(sharingIntent, "Paylaş"));
*/
                View v1 = getWindow().getDecorView().getRootView();
                // View v1 = iv.getRootView(); //even this works
                // View v1 = findViewById(android.R.id.content); //this works too
                // but gives only content
                v1.setDrawingCacheEnabled(true);
                Bitmap myBitmap = v1.getDrawingCache();
                saveBitmap(myBitmap);

            }
        });


    }

    @NeedsPermission({Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS})
    void saveBitmap(Bitmap bitmap) {
        String filePath = Environment.getExternalStorageDirectory()
                + File.separator + "Pictures/screenshot.png";
        File imagePath = new File(filePath);
        FileOutputStream fos;
        try {
            fos = new FileOutputStream(imagePath);
            bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
            fos.flush();
            fos.close();
            sendMail(filePath);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    void sendMail(String path) {

        Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
                new String[]{getString(R.string.mail_name)});
        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
                getString(R.string.mail_subject));
        emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
                getString(R.string.mail_content));
        emailIntent.setType("image/png");
        Uri myUri = Uri.parse("file://" + path);
        emailIntent.putExtra(Intent.EXTRA_STREAM, myUri);
        startActivity(Intent.createChooser(emailIntent, getString(R.string.mail_send)));
    }
}

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

@allo86 You have to run whole project and then classes are being generated

Added it https://github.com/shiraji/PD-274/commit/6984bd084e85630dc4559d0041ebf0aa816c057c . Still generate ResultActvityPermissionsDispatcher.