3

So I would like to use an Augmented Reality SDK (ARToolkit)

Unfortunately, the given code examples are a little outdated (using gradle 0.8 and stuff) so I had to modify the gradle file a little.

I got the following error now:

Error:Attempt to read property 'main' from a write only view of model element 'android.sources' given to rule android.sources { ... } @ aRMarkerDistance\build.gradle line 23, column 5

Line 23 is the android.sources line.

Gradle file:

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

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

    defaultConfig.with {
        applicationId = "org.ar.artoolkit.org.ARMarkerdistance"
        minSdkVersion.apiLevel = 15
        targetSdkVersion.apiLevel = 22
        versionCode = 104
        versionName = "1.0.4"
    }

}
android.buildTypes {
    release {
        minifyEnabled = false
        proguardFiles.add(file('proguard-rules.pro'))
    }
}
android.sources {
    main.jni {
        source {
            srcDirs = ['src/main/nop']
        }
    }
    main.jniLibs {
        source {
            srcDirs = ['src/main/libs']
        }
    }
}
}

dependencies {
    compile project(':aRBaseLib')
}

Please help if you can.

Adam Varhegyi
  • 11,307
  • 33
  • 124
  • 222
  • Can u try AWalkmen's solutoin here http://stackoverflow.com/questions/33845483/how-to-build-sipdroid-in-android-studio – Raghavendra Oct 19 '16 at 09:58
  • Its too risky, I dont want to use`gradle-experimental:0.3.0-alpha7` on any project. Its way too old. I have to keep up the rest of the project with the recent version of gradle plugin. – Adam Varhegyi Oct 19 '16 at 12:28

1 Answers1

8

Cause

In the gradle experimental the syntax has changed from main.jni to main{ jni {}}. For more information on the most updated here is the link: http://tools.android.com/tech-docs/new-build-system/gradle-experimental

Solution

In order to solve this issue please replace your following gradle android.source with the following:

android.sources {
    main {
        jni {
            source {
                srcDirs = ['src/main/nop']
            }
        }
    }
    main {
        jniLibs {
            source {
                srcDirs = ['src/main/libs']
            }
        }
    }
}
  • 1
    great! worked for me; still think gradle and cocoapods are silly though - case and point. Also had to change the += syntax for the proguardFiles to the proguardFiles.add() syntax shown above. But that of course is to solve a different error. – Reece Nov 07 '16 at 22:44