Gradle build error 1,0 - android

I have tried to solve this problem by using previous posts on this forum and none of them worked. Can someone show me exactly what the problem is and how to solve it for this gradle?
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "org.tensorflow.lite.demo"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Remove this block.
jackOptions {
enabled true
}
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
noCompress "tflite"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
maven {
url 'https://google.bintray.com/tensorflow'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'org.tensorflow:tensorflow-lite:+'
testCompile 'junit:junit:4.12'
}
Error: (1,0)=: plugin with id com.android.application not found
Posts i have already tried: Error:(1, 0) Plugin with id 'com.android.application' not found - no build.gradle file

Add a buildscript section like below.
You need to define where to download the android plugin.
apply plugin: 'com.android.application'
buildscript {
/**
* The repositories block configures the repositories Gradle uses to
* search or download the dependencies. Gradle pre-configures support for remote
* repositories such as JCenter, Maven Central, and Ivy. You can also use local
* repositories or define your own remote repositories. The code below defines
* JCenter as the repository Gradle should use to look for its dependencies.
*
* New projects created using Android Studio 3.0 and higher also include
* Google's Maven repository.
*/
repositories {
google()
jcenter()
}
/**
* The dependencies block configures the dependencies Gradle needs to use
* to build your project. The following line adds Android plugin for Gradle
* version 3.1.0 as a classpath dependency.
*/
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
}
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "org.tensorflow.lite.demo"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Remove this block.
jackOptions {
enabled true
}
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
noCompress "tflite"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

Related

Failed to transform artifact 'localytics.aar"

After adding to gradle.properties
android.useAndroidX=true
android.enableJetifier=true
I am receiving
Unable to resolve dependency for
':videoplayer#unsignedUnitTest/compileClasspath': Failed to transform
artifact 'localytics.aar
(com.segment.analytics.android.integrations:localytics:1.3.0)' to
match attributes {artifactType=jar}.
This error occurs across all my modules. I need to include the androidX and Jetifier to gradle.properties. Any idea on how I can resolve this?
Here is what I have tried.
1) Add .arr to filetree
api fileTree(dir: 'libs', include: ['*.jar','*.aar'])
2) Clean/Rebuild
3) Invalidate cache/restart
4) Confirmed that gradle offline work setting was disabled. I'm online!
5) Ignore Lint
lintOptions {
checkReleaseBuilds false
abortOnError false
}
Here is the gradle for one of the culprit modules
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion compileSdkVer
defaultConfig {
versionName "1.0"
minSdkVersion minSdkVer
targetSdkVersion targetSdkVer
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
// needed in this module for implementation/integration tests (tests in androidTest)
}
buildTypes {
release {
consumerProguardFiles 'consumer-proguard-rules.pro'
}
unsigned {
consumerProguardFiles 'consumer-proguard-rules.pro'
}
debug {
consumerProguardFiles 'consumer-proguard-rules.pro'
}
}
compileOptions {
targetCompatibility targetCompatibilityVer
sourceCompatibility sourceCompatibilityVer
}
aaptOptions {
// ignore adding files, used for testing, to the apk
ignoreAssetsPattern "!androidTest/**/*.json"
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
dependencies {
api fileTree(dir: 'libs', include: ['*.jar','*.aar'])
androidTestImplementation(deps.espresso, {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation deps.junit
api project(':commonuilib')
}
repositories {
mavenCentral()
}

Dagger 2 with Java 8 error compilation

Dagger 2 don't work with java 8 and Jack enabled.Try to solve this problem with different versions of dagger 2.x Didn't help. Works fine before but when I try to add Java 8 this error occurred:
Error:Execution failed for task ':app:transformJackWithJackForDebug'.
> com.android.jack.ir.JNodeInternalError: java.lang.Exception: java.lang.NoSuchMethodError: com.google.common.base.CharMatcher.whitespace()Lcom/google/common/base/CharMatcher;
App gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.test.my.project"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.google.dagger:dagger:2.5'
annotationProcessor "com.google.dagger:dagger-compiler:2.5"
compile 'com.google.android.gms:play-services-maps:10.0.1'
}
Project gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// 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
}
Charmatcher.whitespace() was introduced in Guava 19. Looks like you have some code that compiles against Guava 19, but end up with something earlier than that on the classpath.

INSTALL_PARSE_FAILED_NO_CERTIFICATES with google-services plugin

I have a big project with different build types and flavors.
It is in production already more than half of the year and I've made more then hundred updates of its version.
Today I need to implement plugin: 'com.google.gms.google-services' into the project and can not run application because INSTALL_PARSE_FAILED_NO_CERTIFICATES.
I'm sure problem with configuration of build types and flavors but before apply plugin: 'com.google.gms.google-services' everything was always well working. Please, help me to understand what can conflict with google-services plugin.
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'retrolambda'
apply plugin: 'android-apt'
apply plugin: 'android'
apply plugin: 'com.google.gms.google-services'
buildscript {
repositories {
mavenCentral()
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:2.4.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
mavenCentral()
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
maven { url "https://github.com/taplytics/Taplytics-Android-SDK/raw/master/AndroidStudio/" }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
dexOptions {
jumboMode = true
}
defaultConfig {
applicationId "com.examplepack.appp"
minSdkVersion 14
targetSdkVersion 23
versionCode 291
versionName "1.0.1.291"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
signingConfigs {
config {
storeFile file('certificate.jks')
storePassword 'examplepass'
keyAlias 'appl'
keyPassword 'examplepass'
}
}
buildTypes {
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
productFlavors {
stage {
}
dev {
}
prod {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/MANIFEST.MF'
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName "com.examplepack.appp"
}
}
retrolambda {
jdk "/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home"
oldJdk System.getenv("JAVA6_HOME")
javaVersion JavaVersion.VERSION_1_6
}
dependencies {
.............
compile 'com.google.android.gms:play-services:8.1.0'
}
There is a known issue with version 1.4-beta2 or newer of the Gradle plugin.
You can use a older version for this to work
I've been dealing with this issue for a while. I decided to try every combination of com.android.tools.build:gradle and com.google.gms:google-services.
This work for me:
Project level:
com.android.tools.build:gradle:1.3.1
com.google.gms:google-services:1.3.1
App Level:
com.google.android.gms:play-services:8.1.0
I also upgraded Google Repository and Sdk Tools to latest versions. I'm using Android Studio 1.4.

Android Studio 0.5.3 android.compileSdkVersion is missing

I'm using Android studio 0.5.3
I keep getting :
Gradle 'OpenBook' project refresh failed:
Cause: android.compileSdkVersion is missing!
Gradle settings
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
sourceSets {
main {
manifest.srcFile '/MyApp/src/main/AndroidManifest.xml'
}
}
}
And My App Buid.gradle
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
sourceSets {
main {
manifest.srcFile '/src/main/AndroidManifest.xml'
}
}
}
dependencies {
// compile 'com.android.support:appcompat-v7:+'
compile project("libraries:library-toast")
compile project("libraries:Volley")
compile project("libraries:actionbarsherlock")
compile project("libraries:Dialoglibrary")
compile project("libraries:google-play-services_lib")
compile project("libraries:PullToRefreshlibrary")
compile project("libraries:facebook")
compile project("libraries:SlidingTabBarlibrary")
compile project("libraries:AndroidPlot-Core")
compile project("libraries:SignUpModule")
compile project("libraries:Jars")
compile project("libraries:UpdateChecker")
compile "com.mixpanel.android:mixpanel-android:4.0.0#aar"
}
Not Sure what to do.
Thanks for any help
You have specified "compileSdkVersion 19" in your build file. Seems like you are missing that SDK (can you post more of the output with the error in it) You need to make sure that you have installed the right SDK using the SDK manager in Android Studio.
Jake Wharton has created a new gradle plugin to automatically keep the SDKs updated https://github.com/JakeWharton/sdk-manager-plugin

Error : cause android.compileSdkVersion is missing

I am recently started to work on the Android Studio. When I am doing sync with gradle then it is giving me a error .
Error : Cause: android.compileSdkVersion is missing!
Guys what could be reason for this, I already have same compileSDKVersion and build tool installed. I see many threads that saying to confirm that you have same sdk version installed in your system but in my case it is already installed.
build.gradle
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets {
instrumentTest.setRoot('src/test')
}
}
I met this problem too, but I don't know whether my solution suit for you.
I just change the position of this script: apply from: 'maven_push.gradle' to the bottom in build.gradle file, and BUILD SUCCESSFUL!
I post my answer here, you can try it.: Building Android Studio project on Jenkins? android.compileSdkVersion is missing
I did this. It works on Android Studio 0.4.6:
/android_common.gradle
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 19
targetSdkVersion 19
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
classpath 'com.github.jcandksolutions.gradle:android-unit-test:+'
}
allprojects {
apply plugin: 'idea'
repositories {
mavenCentral()
mavenLocal()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
}
}
def langLevel = 1.7
idea {
project {
jdkName = langLevel
languageLevel = langLevel
}
}
/app/build.gradle
apply plugin: 'android'
apply from: "${rootDir}/android_common.gradle"
android {
defaultConfig {
versionCode 1
versionName "1.0"
packageName "your.app.package.name"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
compile 'com.squareup.dagger:dagger:1.2.1'
compile 'com.squareup.dagger:dagger-compiler:1.2.1'
compile 'com.j256.ormlite:ormlite-android:4.+'
compile 'joda-time:joda-time:2.+'
}
sourceSets {
instrumentTest.setRoot('src/test')
}
}
apply plugin: 'android-unit-test'
dependencies {
instrumentTestCompile 'junit:junit:4.+'
instrumentTestCompile 'org.robolectric:robolectric:2.3-SNAPSHOT'
testCompile 'junit:junit:4.+'
testCompile 'org.robolectric:robolectric:2.3-SNAPSHOT'
}
If something is missing, and you have clearly declared it, it means that it was queried before it was defined. Move the query (code that requires that variable) somewhere lower, or to a later position in the sequence and it will be fixed.
try this :
apply plugin: 'android'
apply from: "${rootDir}/android_common.gradle"
move your apply from: "${rootDir}/android_common.gradle"
to last lines

Categories

Resources