i have strange problem and i know it is was written before but all solutions not worked :(
Error:Execution failed for task ':app:transformNative_libsWithStripDebugSymbolForDebug'.
java.lang.NullPointerException (no error message)
it was debug before gradle 2.2
i have a week without any solution :(
----project lvl----
----build.gradle----
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.8.1'
classpath 'com.android.tools.build:gradle:2.2.1'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
----app lvl----
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 24
buildToolsVersion = '24.0.3'
defaultConfig {
applicationId = 'com.czar.tunnel.cave'
minSdkVersion.apiLevel = 12
targetSdkVersion.apiLevel = 24
versionCode = 7
versionName = '7.0'
}
ndk {
platformVersion = 12
moduleName = 'game'
toolchain = 'clang'
stl = 'gnustl_static' // recommending gnustl_static/gnustl_shared for android
cppFlags.addAll(['-std=c++11', '-Wall', // glm could not take -Wall -Werror
'-D GLM_FORCE_SIZE_T_LENGTH', '-D GLM_FORCE_RADIANS',
'-I' + file('src/main/jni'),
'-I' + file('src/main/jni/data')])
ldLibs.addAll(['android', 'EGL', 'GLESv2', 'OpenSLES', 'log'])
}
sources {
main {
jni {
dependencies {
project ':nativeactivity' linkage 'static'
}
}
}
}
buildTypes {
release {
minifyEnabled = false
}
}
}
android.lintOptions {
abortOnError = false
}
}
dependencies {
compile 'com.skyfishjy.ripplebackground:library:1.0.1'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.1'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
}
apply plugin: 'com.google.gms.google-services'
----module lvl----
----build.gradle----
----native activity gradle----
apply plugin: 'com.android.model.library'
def ndkDir = System.getenv("ANDROID_NDK_HOME")
def propertiesFile = project.rootProject.file('local.properties')
if (propertiesFile.exists()) {
Properties properties = new Properties()
properties.load(propertiesFile.newDataInputStream())
ndkDir = properties.getProperty('ndk.dir')
}
model {
android {
compileSdkVersion = 24
buildToolsVersion = '24.0.3'
defaultConfig.with {
minSdkVersion.apiLevel = 12
targetSdkVersion.apiLevel = 24
versionCode = 1
versionName = '0.0.1'
}
ndk {
moduleName = 'native-activity'
ldLibs.addAll(['log', 'android'])
ldFlags.add('-c')
}
sources {
main {
jni {
source {
srcDir "${ndkDir}/sources/android/native_app_glue"
}
exportedHeaders {
srcDir "${ndkDir}/sources/android/native_app_glue"
}
}
}
}
}
}
dependencies {
compile 'com.google.android.gms:play-services-ads-lite:9.4.0'
}
Try to change classpath 'com.android.tools.build:gradle:2.2.1' to
classpath 'com.android.tools.build:gradle:1.5.0'
it's work for me..
Related
I've been banging my head on this for quite sometime now,i have added Firebase Phone Auth to one of my Android Modules in a Project,and i have made sure that play services and firebase:auth is at 11.0.2 version,but for some reason,it still says that i'm at different versions at 11.0.2 and 10.2.1,any inputs would be helpful
My Error
Error:Execution failed for task ':sample-videochat-webrtc:transformClassesWithDexForDevDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/iid/zzc;
This is my app level gradle which has Firebase Auth
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.20.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
applicationId "com.xxx.sample.groupchatwebrtc"
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode 3
versionName "1.0.2-xxx-xxx"
}
productFlavors {
speedDev {
minSdkVersion 21
}
dev {
minSdkVersion rootProject.minSdkVersion
}
}
buildTypes {
debug {
resValue "string", "versionName", "xxx WebRTC\nBuild version " + defaultConfig.getVersionName()
signingConfig signingConfigs.debug
}
release {
resValue "string", "versionName", "xxx WebRTC\nBuild version " + defaultConfig.getVersionName()
signingConfig signingConfigs.debug
}
}
signingConfigs {
debug {
storeFile file("../cert/debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
}
lintOptions {
abortOnError false
}
buildToolsVersion '26.0.1'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.quickblox:quickblox-android-sdk-videochat-webrtc:$rootProject.qbSdkVersion"
compile(project(":sample-core"))
compile "com.android.support:recyclerview-v7:${rootProject.recyclerviewV7Version}"
compile "com.android.support:support-annotations:${rootProject.supportAnnotationsVersion}"
// compile "com.google.firebase:firebase-auth:${rootProject.firebaseVersion}"
compile "com.navercorp.pulltorefresh:library:${rootProject.pullToRefreshVersion}#aar"
compile("com.crashlytics.sdk.android:crashlytics:${rootProject.crashlyticsVersion}#aar") {
transitive = true;
}
compile "com.android.support:cardview-v7:${rootProject.cardView}"
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:11.0.2'
}
apply plugin: 'com.google.gms.google-services'
apply from: "../artifacts.gradle"
And this is my project level gradle which has play services version described
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/"
}
}
}
ext {
compileSdkVersion = 23
buildToolsVersion = "23.1.1"
minSdkVersion = 19
targetSdkVersion = 26
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
lintAbortOnError = false
// QuickBlox SDK version
qbSdkVersion = '3.3.1'
versionName = '3.3.0'
testRunnerVersion = "0.4.1"
// Dependency versions
playServicesVersion = '11.0.2'
supportV4Version = '23.1.1'
cardView = '23.1.1'
appcompatV7Version = '23.1.1'
recyclerviewV7Version = '23.1.1'
supportAnnotationsVersion = '23.1.1'
designVersion = '23.1.1'
uilVersion = '1.9.0'
glideVersion = '3.6.1'
pullToRefreshVersion = '3.2.3'
stickyListHeaders = '2.7.0'
robotoTextViewVersion = '2.4.3'
stickersVersion = '0.7.3'
crashlyticsVersion = '2.6.8'
}
task wrapper(type: Wrapper) {
gradleVersion = '2.10'
}
def makeJar(variant, project) {
//empty
}
I don't know what else to do in this,please any inputs would be really helpful in this
I use this library and want to increase targetSdkVersion to 24 and want to make this change by adding to top level build.gradle file how can I do this?
I changed build.gradle file to this, but it gives me: cannot find AndroidManifest
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24.0.2'
defaultConfig {
minSdkVersion 9
targetSdkVersion 24
versionCode 1411005
versionName "14.1.1-RC-5"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
}
}
allprojects {
repositories {
jcenter()
}
}
Add Top-level build file where you can add configuration options common to all sub-projects/modules.
Add following in build.gradle(project root) file.
ext {
configuration = [
appName : "app_Name",
applicationId : "com.xx.xxx.app",
minSdkVersion : 14,
targetSdkVersion : 24,
compileSdkVersion: 24,
versionCode : 6,
versionName : "1.3.6",
buildToolsVersion: "23.0.3",
]
libraries = [
supportVersion: "24.2.1"
]
}
In modules
def appConfig = rootProject.ext.configuration;
def libs = rootProject.ext.libraries;
dependencies {
compile project(':multiselect')
compile "com.android.support:appcompat-v7:${libs.supportVersion}"
}
For example
Root gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
ext {
configuration = [
appName : "app name",
applicationId : "com.xx.xx.app",
minSdkVersion : 14,
targetSdkVersion : 24,
compileSdkVersion: 24,
versionCode : 6,
versionName : "1.3.6",
buildToolsVersion: "23.0.3",
]
libraries = [
supportVersion: "24.2.1"
]
}
buildscript {
repositories {
jcenter() // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
task checkstyle(type: Checkstyle) {
showViolations = true
configFile file("../config/checkstyle/checkstyle.xml")
source 'src/main/java'
include '**/*.java'
exclude '**/gen/**'
exclude '**/R.java'
exclude '**/BuildConfig.java'
// empty classpath
classpath = files()
}
}
task clean(type: Delete) {
delete(rootProject.buildDir)
}
App Gradle
apply plugin: 'com.android.application'
apply plugin: 'checkstyle'
def appConfig = rootProject.ext.configuration;
def libs = rootProject.ext.libraries;
android {
compileSdkVersion appConfig.compileSdkVersion
buildToolsVersion appConfig.buildToolsVersion
defaultConfig {
applicationId appConfig.applicationId
minSdkVersion appConfig.minSdkVersion
targetSdkVersion appConfig.targetSdkVersion
versionCode appConfig.versionCode
versionName appConfig.versionName
signingConfig signingConfigs.config
}
buildTypes {
release {
}
debug {
}
}
productFlavors {
}
}
dependencies {
compile project(':multiselect')
compile "com.android.support:appcompat-v7:${libs.supportVersion}"
compile "com.android.support:cardview-v7:${libs.supportVersion}"
compile "com.android.support:recyclerview-v7:${libs.supportVersion}"
compile "com.android.support:design:${libs.supportVersion}"
}
Module Gradle
apply plugin: 'com.android.library'
def appConfig = rootProject.ext.configuration;
def libs = rootProject.ext.libraries;
android {
compileSdkVersion appConfig.compileSdkVersion
buildToolsVersion appConfig.buildToolsVersion
defaultConfig {
minSdkVersion appConfig.minSdkVersion
targetSdkVersion appConfig.targetSdkVersion
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile "com.android.support:appcompat-v7:${libs.supportVersion}"
compile "com.android.support:design:${libs.supportVersion}"
}
For more about Configure Your Build
You can also try this.
TOP level build gradle
ext {
androidCompileSdkVersion = 25
androidBuildToolsVersion = '25.0.1'
androidMinSdkVersion = 14
androidTargetSdkVersion = 25 }
ext {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
supportLibraryVersion = '25.0.1'
retrofitVersion = '2.3.0'
okhttpVersion = '3.6.0'
parcelerApiVersion = '1.1.9'
daggerVersion = '2.5'
butterknifeVersion = '8.7.0'
dependencies = [
appCompat : "com.android.support:appcompat-v7:$supportLibraryVersion",
recyclerView : "com.android.support:recyclerview-v7:$supportLibraryVersion",
cardView : "com.android.support:cardview-v7:$supportLibraryVersion",
designSupport: "com.android.support:design:$supportLibraryVersion",
support : "com.android.support:support-v4:$supportLibraryVersion",
retrofit :
"com.squareup.retrofit2:retrofit:$retrofitVersion",
retrofitConverterGson: "com.squareup.retrofit2:converter-gson:$retrofitVersion",
retrofitAdapterRxJava: "com.squareup.retrofit2:adapter-rxjava:$retrofitVersion",
retrofitLogging : "com.squareup.okhttp3:logging-interceptor:$okhttpVersion",
rxAndroid : 'io.reactivex.rxjava2:rxandroid:2.0.1',
rxJava : 'io.reactivex.rxjava2:rxjava:2.1.0',
rxBinding : 'com.jakewharton.rxbinding:rxbinding:0.4.0',
butterknife : "com.jakewharton:butterknife:$butterknifeVersion",
butterknifecompiler : "com.jakewharton:butterknife-compiler:$butterknifeVersion",
] }
APP level build gradle
android {
compileSdkVersion rootProject.ext.androidCompileSdkVersion
buildToolsVersion rootProject.ext.androidBuildToolsVersion
defaultConfig {
applicationId "com.developerandroid"
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 1
versionName "1.0"
}
packagingOptions {
exclude 'META-INF/rxjava.properties'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
Map<String, String> dependencies = rootProject.ext.dependencies
//support
compile dependencies.appCompat
compile dependencies.recyclerView
compile dependencies.cardView
compile dependencies.designSupport
compile dependencies.support
// retrofit
compile dependencies.retrofit
compile dependencies.retrofitConverterGson
compile dependencies.retrofitLogging
compile dependencies.retrofitAdapterRxJava
// rx
compile dependencies.rxJava
compile dependencies.rxAndroid
compile dependencies.rxBinding
}
Updated Android Studio from 2.1.2 -> 2.1.3 this morning and receiving the following gradle sync error:
Error:Unable to find method
'org.gradle.api.internal.file.DefaultSourceDirectorySet.(Ljava/lang/String;Ljava/lang/String;Lorg/gradle/api/internal/file/FileResolver;)V'.
I'm pretty sure it's related to the following library project:
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.7.0'
}
}
apply plugin: 'com.android.library'
apply plugin: 'com.google.protobuf'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
debug {
minifyEnabled false
}
}
sourceSets {
main {
proto {
srcDir 'src/main/protos'
}
java {
srcDir 'src/main/java'
}
manifest {
srcFile 'src/main/AndroidManifest.xml'
}
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-2'
compile project(':wallpaperpicker-resources')
}
protobuf {
// Configure the protoc executable
protoc {
// Download from repositories
artifact = 'com.google.protobuf:protoc:3.0.0-alpha-3'
}
}
Looks like my previous gradle plugin version was 1.3.0 - am I missing some change that occurred related to the sourceSets block?
Try to update the protobuf version:
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.0'
ced's answer led me to the solution. It appears that newer versions of gradle, the Android Studio gradle plugin, and the google protoc plugin wouldn't play nice. I had to upgrade the google protoc plugin as ced noted - but this was a large departure from 0.7.0. The javanano protoc compiler is no longer recommended (and I couldn't get it to work at all). This is the javalite solution that I ended up using.
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.0'
}
}
apply plugin: 'com.android.library'
apply plugin: 'com.google.protobuf'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
debug {
minifyEnabled false
}
}
sourceSets {
main {
proto {
srcDir 'src/main/proto'
}
java {
srcDirs = ['src/main/java','$buildDir/generated-sources/release/javalite']
}
manifest {
srcFile 'src/main/AndroidManifest.xml'
}
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-2'
compile 'com.google.protobuf:protoc-gen-javalite:3.0.0'
compile 'com.google.protobuf:protobuf-lite:3.0.0'
compile project(':wallpaperpicker-resources')
}
protobuf {
generatedFilesBaseDir = "$projectDir/build/generated-sources"
protoc {
// Download from repositories
artifact = 'com.google.protobuf:protoc:3.0.0'
}
plugins {
javalite {
// The codegen for lite comes as a separate artifact
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
}
}
generateProtoTasks {
all().each { task ->
task.plugins {
javalite {
//remove some of the javalite extra packaging
outputSubDir = ''
}
}
}
}
}
apply plugin: 'idea'
idea {
module {
sourceDirs += file("$buildDir/generated-sources/release/javalite");
}
}
This question already has an answer here:
OpenCv with Android studio 1.3+ using new gradle - undefined reference
(1 answer)
Closed 7 years ago.
I'm trying to build project with module which uses NDK.
But Gradle build gives error.
this is my build.gradle(Main project)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// classpath 'com.android.tools.build:gradle-experimental:0.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
when I try to use this gradle:1.5.0 it gives error '
Error:(17, 0) Plugin with id 'com.android.model.application' not found.'
On the other hand, If I use gradle-experimental:0.1.0 it gives error '
Error:(17, 0) Plugin with id 'com.android.application' not found.'
How can I solve this error? I have several modules in my project. How can I set gradle with satisfying all modules?
EDITED :
build.gradle(Main project)
buildscript {
repositories {
jcenter()
}
dependencies {
// classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.android.tools.build:gradle-experimental:0.4.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
def isReleaseBuild() {
return isTag() && !isSnapshot()
}
def isSnapshot() {
return version.contains("SNAPSHOT")
}
boolean isTravis() {
return System.getenv('TRAVIS_BUILD_NUMBER') ? true : false
}
boolean isTag() {
def tag = System.getenv('TRAVIS_TAG')
return !(tag == null || tag.isEmpty())
}
def buildNumber() {
return System.getenv('TRAVIS_BUILD_NUMBER') ?: "0"
}
build.gradle(app)
apply plugin: 'com.android.model.application'
repositories {
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
maven {
url "https://oss.sonatype.org/content/repositories/releases"
}
maven {
url "https://oss.sonatype.org/content/repositories/staging"
}
}
model {
android {
compileSdkVersion = 22
buildToolsVersion = "22.0.1"
defaultConfig.with {
applicationId = "com.ToxicBakery.viewpager.transforms"
minSdkVersion.apiLevel = 16
targetSdkVersion.apiLevel = 22
versionCode = 1
versionName = "1.0"
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.txt')
}
}
android.lintOptions {
checkReleaseBuilds = false
}
}
dependencies {
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'info.hoang8f:fbutton:1.0.5'
compile project(':contextMenu')
compile project(':library')
compile project(':library2')
compile project(':titanic')
compile files('libs/universal-image-loader-1.9.4.jar')
compile project(':staggeredview')
compile project(':min3d')
}
build.gradle(contextmenu)
apply plugin: 'com.android.model.library'
model {
android {
compileSdkVersion = 21
buildToolsVersion = "21.1.2"
defaultConfig.with {
minSdkVersion.apiLevel = 11
targetSdkVersion.apiLevel = 21
}
}
android.lintOptions {
checkReleaseBuilds = false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.nineoldandroids:library:2.4.0'
}
build.gradle(library)
apply plugin: 'com.android.model.library'
apply plugin: 'signing'
model {
android {
compileSdkVersion = 22
buildToolsVersion = "22.0.1"
defaultConfig.with {
minSdkVersion.apiLevel = 13
targetSdkVersion.apiLevel = 22
versionCode = 1
versionName = "1.0"
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.txt')
}
}
android.lintOptions {
checkReleaseBuilds = false
}
}
dependencies {
compile 'com.android.support:support-v13:22.1.1'
}
apply from: '../maven_push.gradle'
build.gradle(library2)
apply plugin: 'com.android.model.library'
model {
android {
compileSdkVersion = 22
buildToolsVersion = "22.0.1"
defaultConfig.with {
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 22
versionCode = 1
versionName = "1.0"
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.txt')
}
}
android.lintOptions {
checkReleaseBuilds = false
}
}
dependencies {
}
build.gradle(min3d)
apply plugin: 'com.android.model.library'
model {
android {
compileSdkVersion = 15
buildToolsVersion = "21.0.2"
defaultConfig.with {
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 22
versionCode = 1
versionName = "1.0"
}
}
android.buildTypes {
debug {
}
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.txt')
}
}
android.productFlavors {
}
android.lintOptions {
checkReleaseBuilds = false
}
}
dependencies {
compile 'com.android.support:appcompat-v7:20.0.0'
compile fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
}
build.gradle(staggerdview)
apply plugin: 'com.android.model.library'
dependencies {
compile 'com.android.support:support-v4:19.1.+'
}
model {
android {
compileSdkVersion = 22
buildToolsVersion = "22.0.1"
defaultConfig.with {
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 22
versionCode = 1
versionName = "1.0"
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.txt')
}
}
android.lintOptions {
checkReleaseBuilds = false
}
}
build.gradle(titanic)
apply plugin: 'com.android.model.library'
model {
android {
compileSdkVersion = 22
buildToolsVersion = '22.0.1'
defaultConfig.with {
minSdkVersion.apiLevel = 11
targetSdkVersion.apiLevel = 19
versionCode = 1
versionName = "1.0"
}
}
android.buildTypes{
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.txt')
}
}
android.lintOptions {
checkReleaseBuilds = false
}
}
dependencies {
compile 'com.android.support:appcompat-v7:20.+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
You should use experimental plugin for NDK purpose:
So your build.gradle(Main Project) will look like:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.4.0'
}
}
allprojects {
repositories {
jcenter()
}
}
and build.gradle(app) will look like:
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
defaultConfig.with {
applicationId = "com.sample.codecator"
minSdkVersion.apiLevel = 19
targetSdkVersion.apiLevel = 19
}
}
}
If you are using any library module then its build.gradle will look like:
apply plugin: 'com.android.model.library'
model {
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
defaultConfig.with {
minSdkVersion.apiLevel = 19
targetSdkVersion.apiLevel = 19
}
}
}
You should put following out of android{...} block:
android.buildTypes
android.sources
android.productFlavors
Like:
model {
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
defaultConfig.with {
minSdkVersion.apiLevel = 19
targetSdkVersion.apiLevel = 19
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles.add(file("proguard-rules.pro"))
}
}
android.productFlavors {
//
}
android.sources {
//
}
}
Do not forget to set ndk.dir=ndk_path in your local.properties file.
UPDATE
Update android.buildTypes code in your all files like this:
android.buildTypes {
release {
minifyEnabled = false
proguardFiles.add(file("proguard-rules.pro"))
}
}
Error:(1, 0) Plugin with id 'com.android.application' not found
i googled and searching since 3days but didn't get solution..... stuck totally **
i gradle version :2.5..
**build.gradle(projetc:android)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle-experimental:0.2.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(module:app)
apply plugin: "com.android.model.application"
model {
android {
compileSdkVersion = 22
buildToolsVersion = "22.0.1"
defaultConfig.with {
applicationId = "com.example.altaf.Android"
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 22
versionCode = 1
versionName = "1.0"
buildConfigFields.with {
create() {
type = "int"
name = "VALUE"
value = "1"
}
}
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles.add(file("proguard-rules.pro"))
}
}
android.productFlavors {
create("flavor1") {
applicationId = "com.app"
}
}
// Configures source set directory.
android.sources {
main {
java {
source {
srcDir "src"
}
}
}
}
}
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:22.2.0"
}
build.gradle(module:opencvlibrary310)
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 21
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
modify your build.gradle(module:opencvlibrary310) like this:
apply plugin: "com.android.model.application"
model {
android {
compileSdkVersion = 22
buildToolsVersion = "22.0.1"
defaultConfig.with {
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 22
}
}
}
and I'm using below version of experimental gradle plugin:
classpath 'com.android.tools.build:gradle-experimental:0.4.0'
Update:
Remove below lines from app file:
android.sources {
main {
java {
source {
srcDir "src"
}
}
}
}
I hope it helps.
Change apply plugin: "com.android.application"
instead of apply plugin: "com.android.model.application" in build.gradle(module:app)