草庐IT

android - versionName 不能直接在 mergedFlavor 上设置,更新到 gradle 5.1.1

coder 2023-12-23 原文

我已经从 3.1.1 更新到 Gradle 发行版 5.1.1,它涉及很多更改,包括更新 androidX 支持库。出于某种原因,build 一直未能要求更改 versionName 在 merged flavor 中的设置方式。我无法弄清楚我到底错过了什么,已经添加了 gradle 构建结果建议的代码。

构建.gradle

buildscript {
ext.kotlin_version = '1.3.40'
System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'
repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url 'https://nexus.dminc-gtc.com/nexus/content/groups/public/' }
    maven { url "https://jitpack.io" }
    maven { url 'https://maven.google.com' }
    maven { url 'https://repo.spring.io/libs-milestone' }

    mavenLocal()
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
    maven { url "https://plugins.gradle.org/m2/" }
    google()
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.4.1'
    //annotationProcessor  'com.neenbedankt.gradle.plugins:android-apt:1.4'
    classpath 'com.dminc.gradle:android-release-plugin:1.0.0'
    classpath 'io.fabric.tools:gradle:1.27.1'
    classpath 'com.github.triplet.gradle:play-publisher:1.1.5'
    classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.5"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.google.gms:google-services:4.0.1'
    classpath 'com.github.alexfu:androidautoversion:3.0.2'
 }
}

  repositories {
  maven { url 'https://maven.fabric.io/public' }
  maven { url 'https://nexus.dminc-gtc.com/nexus/content/groups/public/' }
  mavenLocal()
  mavenCentral()
  jcenter()
  flatDir {
      dirs 'libs'
  }
  maven { url "https://jitpack.io" }


  maven { url 'http://maven.localytics.com/public' }
  maven { url 'https://maven.google.com' }
  maven { url 'https://repo.spring.io/libs-milestone' }

  maven {
      url 'https://maven.google.com/'
      name 'Google'
  }
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
//apply plugin: 'android-apt'
apply plugin: 'android-release-plugin'
apply plugin: 'com.google.gms.google-services'
apply from: 'checkstyle.gradle'
apply from: 'pmd.gradle'
apply from: 'findbugs.gradle'
apply plugin: 'com.github.triplet.play'
apply from: 'sonar.gradle'
apply plugin: 'com.github.alexfu.androidautoversion'

ext.androidAnnotationsVersion = '4.6.0'

android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 28
defaultConfig {
    // These are applied to the manifest, to prevent nasty compat modes, use the latest you can.
    minSdkVersion 19
    targetSdkVersion 28
    renderscriptTargetApi 19
    renderscriptSupportModeEnabled true
}

releaseConfig {
    // Set to true to add the version number from the apk name (default is false)
    addVersionToApk false
    // No default for propertyFile, you HAVE to specify it, it will be interpreted by the plugin as follow: [root_dir]/[propertyFile]
    propertyFile "version.properties"
}


flavorDimensions 'white_label', 'server'
productFlavors {
    newmoove {
        // Assigns this product flavor to the "version" flavor dimension.
        // This property is optional if you are using only one dimension.
        dimension "white_label"
        applicationId 'com.app.newmoove'
        manifestPlaceholders = [crashlyticsApiKey: "*******************",
                                facebookAppId    : "*************"]


    }
    wexer {
        // Assigns this product flavor to the "version" flavor dimension.
        // This property is optional if you are using only one dimension.
        dimension "white_label"
        applicationId 'com.app.wexer'
        manifestPlaceholders = [crashlyticsApiKey: "*********************",
                                facebookAppId    : "*************"]


    }
    customfit {
        // Assigns this product flavor to the "version" flavor dimension.
        // This property is optional if you are using only one dimension.
        dimension "white_label"
        applicationId 'com.appname.app'
        manifestPlaceholders = [crashlyticsApiKey: "**********************"]

    }
    dev {
        dimension "server"
        applicationIdSuffix ".devtest"
        versionNameSuffix "-dev"

    }
    integration {
        dimension "server"
        applicationIdSuffix ".integration"
        versionNameSuffix "-integration"

    }
    staging {
        dimension "server"
        applicationIdSuffix ".staging"
        versionNameSuffix "-staging"

    }
    live {
        dimension "server"

    }
}
// A lot of 3rd party libraries contain similar stuff.
packagingOptions {
    exclude 'LICENSE.*'
    exclude 'NOTICE.*'
    exclude 'META-INF/services/javax.annotation.processing.Processor'
}
lintOptions {
    quiet true
    abortOnError false
    ignoreWarnings true
}

applicationVariants.all { variant ->
    variant.outputs.each { output ->
        output.versionNameOverride = "5.0.1.91-5.0.1"
    }
  }
}

dependencies {
implementation fileTree(include: '*.jar', dir: 'libs')
implementation(name: 'Android-ViewPagerIndicator', ext: 'aar')
implementation(name: 'Fontify-release', ext: 'aar')
implementation(name: 'HoloGraphLibrary-release', ext: 'aar')
implementation(name: 'slidingmenu-release', ext: 'aar')
implementation 'com.mani:ThinDownloadManager:1.3.0'
implementation 'com.github.johnkil.print:print:1.3.1'
implementation 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
implementation 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0@aar'
implementation 'com.edmodo:rangebar:1.0.0'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'de.greenrobot:eventbus:2.4.1'
implementation 'com.github.johnkil.android-appmsg:appmsg:1.2.0'
implementation 'com.path:android-priority-jobqueue:1.1.2'
implementation 'com.fasterxml.jackson.core:jackson-core:2.9.0'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.9.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.0'
implementation 'com.j256.ormlite:ormlite-android:5.0'
implementation 'com.github.gabrielemariotti.cards:library:1.9.1'
implementation 'se.emilsjolander:stickylistheaders:2.7.0'
implementation 'com.google.code.gson:gson:2.3.1'
implementation 'com.google.android.gms:play-services-analytics:11.2.0'
implementation 'com.google.android.gms:play-services-maps:11.2.0'
implementation 'com.google.android.gms:play-services-location:11.2.0'
implementation 'com.google.android.gms:play-services-auth:11.2.0'
implementation 'com.google.android.gms:play-services-fitness:11.2.0'
implementation 'com.google.android.gms:play-services-ads:11.2.0'
implementation 'com.google.firebase:firebase-messaging:11.2.0'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'org.robolectric:robolectric:3.4'
implementation 'com.facebook.android:facebook-android-sdk:4.+'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {
    transitive = true;
}
implementation 'com.soundcloud.android:android-crop:1.0.1@aar'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.1'
// or 1.4-beta1
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
// or 1.4-beta1
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
// or 1.4-beta1
implementation 'com.localytics.android:library:5.4.0'
implementation 'com.github.tony19:timber-loggly:1.0.1'
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
implementation 'com.github.mmin18:realtimeblurview:1.1.0'
implementation 'org.apache.httpcomponents:httpclient:4.5.9'
implementation 'com.andkulikov:transitionseverywhere:1.7.5'
implementation 'org.ocpsoft.prettytime:prettytime:4.0.1.Final'
implementation 'net.danlew:android.joda:2.9.9'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation('com.devbrackets.android:exomedia:4.0.3') {
    exclude(module: 'support-v4')
    exclude(module: 'appcompat-v7')
}
implementation 'org.springframework.android:spring-android-rest-template:2.0.0.M4'
implementation 'com.github.PhilJay:MPAndroidChart:v2.1.4'
implementation "org.androidannotations:androidannotations:${androidAnnotationsVersion}"
implementation "org.androidannotations:androidannotations-api:${androidAnnotationsVersion}"
implementation "org.androidannotations:rest-spring-api:${androidAnnotationsVersion}"
implementation "org.androidannotations:rest-spring:${androidAnnotationsVersion}"
implementation "org.androidannotations:ormlite-api:${androidAnnotationsVersion}"
implementation "org.androidannotations:ormlite:${androidAnnotationsVersion}"
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'

implementation 'com.stripe:stripe-android:6.1.0'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation('androidx.cardview:cardview:1.0.0') {
    force = true
}
implementation 'jp.wasabeef:blurry:2.1.1'
implementation 'com.otaliastudios:nestedscrollcoordinatorlayout:1.0.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

//rx
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
implementation 'com.google.firebase:firebase-core:11.2.0'
implementation 'com.google.firebase:firebase-invites:11.2.0'

implementation group: 'com.neenbedankt.gradle.plugins', name: 'android-apt', version: '1.8'
}

无论我做什么,在构建项目时都无法通过以下错误。

最佳答案

在 build.gradle 中进行此更改(在错误窗口中建议)并进行干净的构建。

关于android - versionName 不能直接在 mergedFlavor 上设置,更新到 gradle 5.1.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56742072/

有关android - versionName 不能直接在 mergedFlavor 上设置,更新到 gradle 5.1.1的更多相关文章

  1. ruby-on-rails - 如何验证 update_all 是否实际在 Rails 中更新 - 2

    给定这段代码defcreate@upgrades=User.update_all(["role=?","upgraded"],:id=>params[:upgrade])redirect_toadmin_upgrades_path,:notice=>"Successfullyupgradeduser."end我如何在该操作中实际验证它们是否已保存或未重定向到适当的页面和消息? 最佳答案 在Rails3中,update_all不返回任何有意义的信息,除了已更新的记录数(这可能取决于您的DBMS是否返回该信息)。http://ar.ru

  2. ruby-on-rails - 使用 rails 4 设计而不更新用户 - 2

    我将应用程序升级到Rails4,一切正常。我可以登录并转到我的编辑页面。也更新了观点。使用标准View时,用户会更新。但是当我添加例如字段:name时,它​​不会在表单中更新。使用devise3.1.1和gem'protected_attributes'我需要在设备或数据库上运行某种更新命令吗?我也搜索过这个地方,找到了许多不同的解决方案,但没有一个会更新我的用户字段。我没有添加任何自定义字段。 最佳答案 如果您想允许额外的参数,您可以在ApplicationController中使用beforefilter,因为Rails4将参数

  3. 安卓apk修改(Android反编译apk) - 2

    最近因为项目需要,需要将Android手机系统自带的某个系统软件反编译并更改里面某个资源,并重新打包,签名生成新的自定义的apk,下面我来介绍一下我的实现过程。APK修改,分为以下几步:反编译解包,修改,重打包,修改签名等步骤。安卓apk修改准备工作1.系统配置好JavaJDK环境变量2.需要root权限的手机(针对系统自带apk,其他软件免root)3.Auto-Sign签名工具4.apktool工具安卓apk修改开始反编译本文拿Android系统里面的Settings.apk做demo,具体如何将apk获取出来在此就不过多介绍了,直接进入主题:按键win+R输入cmd,打开命令窗口,并将路

  4. objective-c - 在设置 Cocoa Pods 和安装 Ruby 更新时出错 - 2

    我正在尝试为我的iOS应用程序设置cocoapods但是当我执行命令时:sudogemupdate--system我收到错误消息:当前已安装最新版本。中止。当我进入cocoapods的下一步时:sudogeminstallcocoapods我在MacOS10.8.5上遇到错误:ERROR:Errorinstallingcocoapods:cocoapods-trunkrequiresRubyversion>=2.0.0.我在MacOS10.9.4上尝试了同样的操作,但出现错误:ERROR:Couldnotfindavalidgem'cocoapods'(>=0),hereiswhy:U

  5. ruby-on-rails - Rails Associations 的更新方法是什么? - 2

    这太简单了,太荒谬了,我在任何地方都找不到关于它的任何信息,包括API文档和Rails源代码:我有一个:belongs_to关联,我开始理解当您没有关联时您在Controller中调用的正常模型方法与您有关联时调用的方法略有不同。例如,我的关联在创建Controller操作时运行良好:@user=current_user@building=Building.new(params[:building])respond_todo|format|if@user.buildings.create(params[:building])#etcetera但我找不到关于更新如何工作的文档:@user

  6. ruby - 为什么不能使用类IO的实例方法noecho? - 2

    print"Enteryourpassword:"pass=STDIN.noecho(&:gets)puts"Yourpasswordis#{pass}!"输出:Enteryourpassword:input.rb:2:in`':undefinedmethod`noecho'for#>(NoMethodError) 最佳答案 一开始require'io/console'后来的Ruby1.9.3 关于ruby-为什么不能使用类IO的实例方法noecho?,我们在StackOverflow上

  7. ruby-on-rails - Ruby rand() 不能接受变量? - 2

    我对此有点困惑。我在RoR项目中的最终目标是从我的数据库中获取单个随机配置文件。我想它应该是这样的:@profile=Profile.find_by_user_id(rand(User.count))它一直抛出错误,因为user_id0不存在,所以我把它的一部分拿出来检查发生了什么:@r=rand(User.count)每次都返回0。发生什么了?我注册了5个假用户和5个相关配置文件来测试这个。如果我将Profile.find_by_user_id(rand(User.count))重写为Profile.find_by_user_id(3)它工作得很好。User.count也在工作。所以

  8. ruby - 为什么我不能从 ruby​​ 中的选定键创建新的散列? - 2

    这个问题困扰了我一段时间。这不是一件困难的事情,但我不知道为什么没有简单的方法来做到这一点,我敢打赌有但我没有看到。我只想取一个散列,像这样:cars={:bob=>'Pontiac',:fred=>'Chrysler',:lisa=>'Cadillac',:mary=>'Jaguar'}然后做类似的事情cars[:bob,:lisa]得到{:bob=>'Pontiac',:lisa=>'Cadillac'}我这样做了,效果很好:classHashdefpick(*keys)Hash[select{|k,v|keys.include?(k)}]endendruby-1.8.7-p249

  9. ruby-on-rails - OSX Yosemite 更新破坏了 pow.cx - 2

    升级到OSXYosemite后,我现有的pow.cx安装不起作用。升级到最新的pow.cx无效。通过事件监视器重新启动它也没有成功。 最佳答案 卸载(!)并重新安装解决了这个问题。curlget.pow.cx/uninstall.sh|shcurlget.pow.cx|sh 关于ruby-on-rails-OSXYosemite更新破坏了pow.cx,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/q

  10. ruby-on-rails - 为什么 Rails 可以使用 `if` 作为哈希键但在 Ruby 中不能 - 2

    在纯Rubyirb中,不能输入{if:1}。该语句不会终止,因为irb认为if不是符号,而是if语句的开始。那么为什么Rails可以有before_filter接受if作为参数?该指南的代码如下:classOrderunless也会发生同样的事情。 最佳答案 这是一个irb问题,而不是Ruby。bash=>ruby-e"puts({if:1})"bash=#{:if=>1}您可以改用pry。它将正确读取输入。https://github.com/pry/pry 关于ruby-on-rai

随机推荐