skip to Main Content

I have migrated my project to android x and I need to create Apk of the project through android studio Build>>Build Bundle(s) /APK(s)>>Build Apk(s). But when I do this it gives me the following error as in the screen shot below:
enter image description here

But when I comment out the highlighted section in the below build.gradle file as shown in picture below build is created by going through Build>>Build Bundle(s) /APK(s)>>Build Apk(s) process
enter image description here

I have tried every solution on internet eg invalidate caches and restart, clean project and using androidComponent{ instead of android.applicationVariants.all {

Any help would be appreciated orany work around this situation.

Thanks in advance 🙂

Here is my build.gradle:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

//    dependencies {
//        classpath 'io.fabric.tools:gradle:1.25.4'
//    }
}
apply plugin: 'com.android.application'
//apply plugin: 'io.fabric'

android {
    signingConfigs {
        debug {
            storeFile file('D:\RAM MOBILE APPLICATION\keystore\debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
    }
    compileSdkVersion 28
    useLibrary 'org.apache.http.legacy'
    flavorDimensions "default"
    lintOptions{
        checkReleaseBuilds false
    }

    defaultConfig {
        applicationId "com.ram.courier"
        minSdkVersion 19
        targetSdkVersion 28
        multiDexEnabled true
        versionCode 22
        signingConfig signingConfigs.debug
        vectorDrawables.useSupportLibrary = false
        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
        archivesBaseName = "RAMMobileUAT-2.9.60.apk"

    }
    buildTypes {
        release {
            debuggable false
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable false
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    productFlavors {
        Uat {
            dimension "default"
            versionName "2.9.60"

//          External IP address UAT - for testing on winjit network
//          buildConfigField 'String', 'BASE_URL', '"http://41.21.176.123/rammobileweb/clientdataservice.asmx?wsdl"'
//          buildConfigField 'String', 'BASE_URL_MISSING_IMAGES', '"http://41.21.176.123/RAMMobileWeb/AndroidSessionSyncWS.asmx?wsdl"'
//          buildConfigField 'String', 'BASE_URL_EMAIL', '"http://41.21.176.123/RAMCSDPortalV3/DataServices/MobileDeviceIntegration.asmx?wsdl"'
//          buildConfigField 'String', 'BASE_URL_SYNC', '"http://41.21.176.123/RAM.Microservices.Mobile.API/api/v1.0/SessionSync/"'
//          buildConfigField 'String', 'BASE_URL_SYNC', '"https://azapp-rammobileservices-uat-001.azurewebsites.net/api/v1/SessionSync/"'

//          New URLS with Load balance setup
            buildConfigField 'String', 'BASE_URL', '"http://api.amss.uat.ram.co.za/RAMMobileWeb/ClientDataService.asmx?wsdl"'
            buildConfigField 'String', 'BASE_URL_MISSING_IMAGES', '"http://api.amss.uat.ram.co.za/RAMMobileWeb/AndroidSessionSyncWS.asmx?wsdl"'
            buildConfigField 'String', 'BASE_URL_EMAIL', '"http://api.amss.uat.ram.co.za/RAMCSDPortalV3/DataServices/MobileDeviceIntegration.asmx?wsdl"'
            buildConfigField 'String', 'BASE_URL_SYNC', '"http://api.amms.uat.ram.co.za/RAM.Microservices.Mobile.API/api/"'

            buildConfigField 'String', 'NAMESPACE', '"http://services.ramgroup.co.za/RAMMobileWeb"'
            buildConfigField 'String', 'NAMESPACEEMAIL', '"http://tempuri.org/"'

            buildConfigField 'String', 'GS_LICENSEKEY', '"533c5006525000010652015939525a0e4a1153091a555d4c105f511468090606570d5d530a0004"'

//          Application Insights keys dev  azapp-rammobileuserlogs-dev-001
//          manifestPlaceholders = [ AI_INSTRUMENTATION_KEY:"c3edea44-9226-4ebf-ab5b-03a2f51775e7"]

//          Application Insights keys UAT  azapp-rammobileuserlogs-uat-001
            manifestPlaceholders = [AI_INSTRUMENTATION_KEY: "b2ad4aa9-bec4-4c82-86c9-2d4d83bce331"]
            return void
        }
        Prod {
            dimension "default"
            versionName "1.28"

//          External IP address PROD - for testing on winjit network
//          buildConfigField 'String', 'BASE_URL', '"http://10.0.20.15/rammobileweb/clientdataservice.asmx?wsdl"'
//          buildConfigField 'String', 'BASE_URL_MISSING_IMAGES', '"http://10.0.20.15/RAMMobileWeb/AndroidSessionSyncWS.asmx?wsdl"'
//          buildConfigField 'String', 'BASE_URL_EMAIL', '"http://10.0.20.15/RAMCSDPortalV3/DataServices/MobileDeviceIntegration.asmx?wsdl"'
//          buildConfigField 'String', 'BASE_URL_SYNC', '"http://10.0.21.118/RAM.Microservices.Mobile.API/api/v1.0/SessionSync/"'

//          New URLS with Load balance setup
            buildConfigField 'String', 'BASE_URL', '"http://api.amss.ram.co.za/RAMMobileWeb/ClientDataService.asmx?wsdl"'
            buildConfigField 'String', 'BASE_URL_MISSING_IMAGES', '"http://api.amss.ram.co.za/RAMMobileWeb/AndroidSessionSyncWS.asmx?wsdl"'
            buildConfigField 'String', 'BASE_URL_EMAIL', '"http://api.amss.ram.co.za/RAMCSDPortalV3/DataServices/MobileDeviceIntegration.asmx?wsdl"'
            buildConfigField 'String', 'BASE_URL_SYNC', '"http://api.amms.ram.co.za/RAM.Microservices.Mobile.API/api/"'


            buildConfigField 'String', 'NAMESPACE', '"http://services.ramgroup.co.za/RAMMobileWeb"'
            buildConfigField 'String', 'NAMESPACEEMAIL', '"http://tempuri.org/"'

            buildConfigField 'String', 'GS_LICENSEKEY', '"533c5006525000010652015939525a0e4a1153091a555d4c105f511468090606570d5d530a0004"'

//          Application Insights keys PROD azapp-rammobileuserlogs-prod-001
            manifestPlaceholders = [AI_INSTRUMENTATION_KEY: "917c7651-6f2a-4cbe-bbe2-dc10d34273ec"]
            return void
        }
    }


//    android.applicationVariants.all { variant ->
//        variant.outputs.all { output ->
//            outputFileName = "RAMMobile_${variant.name}-${variant.versionName}.apk"
//        }
//    }
    repositories {
        mavenCentral()
        maven { url 'https://jitpack.io' }
        google()
    }
    splits {
        abi {
            // Enables building multiple APKs per ABI.
            enable true
            // By default all ABIs are included, so use reset() and include to specify that we only
            // want APKs for x86 and x86_64.
            // Resets the list of ABIs that Gradle should create APKs for to none.
            reset()
            // Specifies a list of ABIs that Gradle should create APKs for.
            include "arm64-v8a"
            // Specifies that we do not want to also generate a universal APK that includes all ABIs.
            universalApk true
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
//    implementation('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') { //log crash
//        transitive = true
//    }
    //noinspection GradleCompatible
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
    implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'de.hdodenhof:circleimageview:2.2.0' //Circular image view
    testImplementation 'junit:junit:4.12'
    implementation files('libs/ksoap2-android-assembly-3.0.0-RC.2-jar-with-dependencies.jar')
    implementation 'com.journeyapps:zxing-android-embedded:3.6.0' //Scanning barcode
    implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0' //Touch listener animation
    implementation 'org.chalup.microorm:microorm:0.8.0' //Access objects
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.gms:play-services-analytics:16.0.0'
    implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    implementation 'me.relex:circleindicator:1.2.2@aar' //Viewpager indicator
    implementation 'com.github.bumptech.glide:glide:4.7.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
    implementation 'com.google.code.gson:gson:2.8.0'
    implementation project(':silky-signature')
    implementation 'com.github.jkwiecien:EasyImage:1.3.1' //Capture image
    implementation 'com.karumi:dexter:5.0.0' //Handling dangerous permissions

    implementation 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.15'

//    //Microsoft Azure Application Insight
    implementation 'com.microsoft.azure:applicationinsights-android:1.0-beta.10'

//    implementation 'com.thegrizzlylabs.geniusscan.sdk:gs-sdk:3.0.16'
    implementation 'com.geniusscansdk:gssdk-core:4.0.8'
//    implementation 'com.geniusscansdk:gssdk-ocr:4.0.8'

   implementation 'com.google.android.gms:play-services-mlkit-text-recognition:16.2.0'

    implementation 'androidx.fragment:fragment:1.0.0'
    //androidx support for tablayout
    implementation "com.google.android.material:material:1.4.0"

}

enter code here

2

Answers


  1. Chosen as BEST ANSWER

    Solved this by making universalApk false!

    It was true before. :')


    1. I think you have not updated your app for a long time.

    2. Syntax of build gradle files has been changed

    3. Create an new app and copy their build gradle syntax or check someone others app
      source code

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search