Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

android

gradle

I upgraded to gradle to 3.1.1 but now i want to change again to 3.0.1 but after changing to 3.0.1 i am getting this error

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

I was using 3.0.1 before and it was working perfectly but i changed after android studio update.

The error is only coming when generating signed apk.

Project Gradle

buildscript {  repositories {     google()     jcenter() } 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 {     google()     jcenter()     maven { url "https://jitpack.io" } } }  task clean(type: Delete) { delete rootProject.buildDir } 

App gradle

apply plugin: 'com.android.application'  android { compileSdkVersion 27 defaultConfig {     applicationId "com.smiles.smartstuddy"     minSdkVersion 16     targetSdkVersion 27     versionCode 4     versionName "1.1"     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"     vectorDrawables.useSupportLibrary = true } packagingOptions {     exclude 'META-INF/DEPENDENCIES'     exclude 'META-INF/LICENSE'     exclude 'META-INF/LICENSE.txt'     exclude 'META-INF/license.txt'     exclude 'META-INF/NOTICE'     exclude 'META-INF/NOTICE.txt'     exclude 'META-INF/notice.txt'     exclude 'META-INF/ASL2.0' } buildTypes {     release {         minifyEnabled false         proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'     } } }  dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.android.support:support-v4:27.1.1' implementation 'com.android.support:support-vector-drawable:27.1.1' implementation 'com.android.support:recyclerview-v7:27.1.1' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' implementation 'com.android.support:design:27.1.1' implementation 'com.android.support:support-v13:27.1.1' compile 'com.github.lzyzsd:circleprogress:1.2.1' compile 'dev.dworks.libs:volleyplus:+' implementation files('libs/YouTubeAndroidPlayerApi.jar') compile 'de.hdodenhof:circleimageview:2.1.0' compile 'commons-io:commons-io:2.4' compile 'com.github.bumptech.glide:glide:4.6.1' compile 'es.voghdev.pdfviewpager:library:1.0.3'  } 
like image 583
user9562014 Avatar asked Apr 13 '18 05:04

user9562014


2 Answers

Check the release folder where the .apk is going to be generated. If there is any existing .apk or .json files, then delete or move them to another location. Try generating your signed apk again and you should be successful.

like image 153
Dan Ross Avatar answered Sep 23 '22 21:09

Dan Ross


I was getting the same error in the same use case and what fixed it for me was to clean and rebuild the project.

like image 29
Aleksandar Dimitrov Avatar answered Sep 22 '22 21:09

Aleksandar Dimitrov