2

I am trying to generate signed apk of my application but this is showing error

Expected a name but was STRING at line 1 column 99 path $[0].apkInfo.versionName

Project Level gradle is:

buildscript {
repositories {

    jcenter()
    google()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'

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

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

task clean(type: Delete) {
delete rootProject.buildDir
}

App level gradle is:

apply plugin: 'com.android.application'
android {
compileSdkVersion 25
defaultConfig {
    applicationId "com.roosterlogic.smartpaani.smartpaanimaintenance"
    minSdkVersion 14
    targetSdkVersion 25
    versionCode 5
    versionName "2.3"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:25.1.1'
implementation 'com.android.support:design:25.1.1'
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'

implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
implementation 'com.google.android.gms:play-services-location:10.2.1'
implementation 'com.google.code.gson:gson:2.7'
implementation 'com.android.support:support-v4:25.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.squareup.picasso:picasso:2.5.2'

implementation 'id.zelory:compressor:2.1.0'
}

Android Studio 3.1 While upgrading I have shifted to gradle 3.1.1 but now I step down at 3.0.1.

What is problem behind this help.

Kisan Thapa
  • 527
  • 1
  • 4
  • 15

3 Answers3

2

recheck the target folder you are going to make your apk. If there is existing apk or json files remove them and try again...

Gihan Gamage
  • 2,944
  • 19
  • 27
  • 1
    This totally worked for me today. I was baffled and the problem was abundantly unclear from the error message so thanks a lot for posting this here! – Tony Adams Nov 09 '18 at 22:54
0

With Gradle 3.1.x you have to set target SDK to 27. So make changes accordingly to build apk with new gradle.

As per doc

3.1.0 (March 2018)

This version of the Android plugin requires the following:

Gradle 4.4 or higher.

Build Tools 27.0.3 or higher.

Community
  • 1
  • 1
Wasim K. Memon
  • 5,979
  • 4
  • 40
  • 55
0

Only this worked for me. Adding to my app/build.gradle:

android {
...


    lintOptions {
        checkReleaseBuilds false
    }
...
}
Jan Jansz
  • 630
  • 7
  • 13