Error:Cannot set readonly property: proguardFiles for class: com.android.build.gradle.managed.BuildType

android

Solution

I got the same error last a few hours. I solved by changing build type as follow -

buildTypes {
        release {
            minifyEnabled false
            proguardFiles 'proguard-rules.pro'
        }
    } 

After that I deleted all ndk imported code line. So my build.gradle of aRSimple is -

apply plugin: 'com.android.model.application'

model {
    android {
        compileSdkVersion = 23
        buildToolsVersion = "23.0.1"

        defaultConfig.with {
            applicationId = "org.artoolkit.ar.samples.ARSimple"
            minSdkVersion.apiLevel = 15
            targetSdkVersion.apiLevel = 22
            versionCode = 1
            //Integer type incremented by 1 for every release, major or minor, to Google store
            versionName = "1.0" //Real fully qualified major and minor release description

            buildConfigFields.with {
                //Defines fields in the generated Java BuildConfig class, in this case, for
                create() {           //default config, that can be accessed by Java code
                    type = "int"     //e.g. "if (1 == BuildConfig.VALUE) { /*do something*/}".
                    name = "VALUE"
                    //See: [app or lib]/build/generated/source/buildConfig/[package path]/
                    value = "1"      //     BuildConfig.java
                }
            }
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles 'proguard-rules.pro'
        }
    }

    android.productFlavors {
    }



    }


dependencies {
    //compile 'com.android.support:support-v4:23.0.1'
    //compile 'com.android.support:appcompat-v7:23.0.1' //Only required when the target device API level is greater than
    compile project(':aRBaseLib')
}                                                       //the compile and target of the app being deployed to the device

Then I create and copied all the .so library file into the jnilibs in applicaion main folder as show in fig

fig

Then run yours. I don't know this is the solution for this. But the errors go and project run without errors. Tell me if you find any other solution for this. Thanks.

Problem

I am trying to run an AR sample app from: https://artoolkit.org/documentation/doku.php?id=4_Android:android_examples I tried to open the project ARSimpleProj. But it gives me this error: ``` Error:Cannot set readonly property: proguardFiles for class: com.android.build.gradle.managed.BuildType ``` I am using Android Studio 2.2.2 and Gradle 2.14.1 Thanks!

Original source