Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

集成之后,打包体积没有变化。。。 #140

Closed
ganshenml opened this issue Feb 20, 2020 · 16 comments
Closed

集成之后,打包体积没有变化。。。 #140

ganshenml opened this issue Feb 20, 2020 · 16 comments

Comments

@ganshenml
Copy link

Please provide the following informations.

  • System version Android10

  • Java version 1.8

  • Gradle version 3.5.2

  • Android Gradle plugin version 5.4.1

  • Booster version 1.3.0

  • Stack traces

        classpath "com.didiglobal.booster:booster-task-compression-pngquant:$booster_version"
        classpath "com.didiglobal.booster:booster-task-compression-processed-res:$booster_version"
        classpath "com.didiglobal.booster:booster-task-resource-deredundancy:$booster_version"
        classpath "com.didiglobal.booster:booster-transform-r-inline:$booster_version"

这是集成之后还要进行代码调用初始化么?

@johnsonlee
Copy link
Collaborator

Please provide the following informations.

  • System version Android10
  • Java version 1.8
  • Gradle version 3.5.2
  • Android Gradle plugin version 5.4.1
  • Booster version 1.3.0
  • Stack traces
        classpath "com.didiglobal.booster:booster-task-compression-pngquant:$booster_version"
        classpath "com.didiglobal.booster:booster-task-compression-processed-res:$booster_version"
        classpath "com.didiglobal.booster:booster-task-resource-deredundancy:$booster_version"
        classpath "com.didiglobal.booster:booster-transform-r-inline:$booster_version"

这是集成之后还要进行代码调用初始化么?

不需要初始化,用法请参考:Booster 示例,如果方便的话,麻烦提供一下 build.gradle

@ganshenml
Copy link
Author

ganshenml commented Feb 21, 2020

Please provide the following informations.

  • System version Android10
  • Java version 1.8
  • Gradle version 3.5.2
  • Android Gradle plugin version 5.4.1
  • Booster version 1.3.0
  • Stack traces
        classpath "com.didiglobal.booster:booster-task-compression-pngquant:$booster_version"
        classpath "com.didiglobal.booster:booster-task-compression-processed-res:$booster_version"
        classpath "com.didiglobal.booster:booster-task-resource-deredundancy:$booster_version"
        classpath "com.didiglobal.booster:booster-transform-r-inline:$booster_version"

这是集成之后还要进行代码调用初始化么?

不需要初始化,用法请参考:Booster 示例,如果方便的话,麻烦提供一下 build.gradle

集成打包是没有问题的,主要是体积没有变化:

buildscript {
    ext.booster_version = '1.3.0'
    repositories {
        jcenter()
        google()
        maven { url 'https://dl.bintray.com/umsdk/release' }
        maven { url 'https://oss.sonatype.org/content/repositories/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.2'
        classpath 'com.novoda:bintray-release:0.5.0'
        classpath "com.didiglobal.booster:booster-task-compression-pngquant:$booster_version"
        classpath "com.didiglobal.booster:booster-task-compression-processed-res:$booster_version"
        classpath "com.didiglobal.booster:booster-task-resource-deredundancy:$booster_version"
        classpath "com.didiglobal.booster:booster-transform-r-inline:$booster_version"
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        maven {
            url 'https://jitpack.io'
        }
        maven { url 'https://dl.bintray.com/umsdk/release' }
        flatDir {        
            dirs 'libs'   
        }
        mavenCentral()
        maven { url 'https://oss.sonatype.org/content/repositories/public' }
        google()
    }
}

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


allprojects {
    tasks.withType(Javadoc) {
        options {
            encoding "UTF-8"
            charSet 'UTF-8'
            links "http://docs.oracle.com/javase/7/docs/api"
        }
    }

}

@johnsonlee
Copy link
Collaborator

classpath 缺少 booster-gradle-plugin,请参考:Booster 示例

@ganshenml
Copy link
Author

classpath "com.didiglobal.booster:booster-gradle-plugin:$booster_version"
加了这么一句,release包的体积依然没有变化。

@johnsonlee
Copy link
Collaborator

有加这行么?

apply plugin: 'com.didiglobal.booster' 

@ganshenml
Copy link
Author

有加这行么?

apply plugin: 'com.didiglobal.booster' 

加过了,但还是没有效果。难不成我这个项目已经是极限了?

@johnsonlee
Copy link
Collaborator

粘下 build/reports 下的报告内容

@ganshenml
Copy link
Author

build下面没有reports这个文件,其下的logs文件夹下有个"manifest-merger-apkname-release-report"这样的文件,是这个?

@johnsonlee
Copy link
Collaborator

试试最新的版本?

@knclj
Copy link

knclj commented Nov 6, 2020

我也碰到这种情况,debug是可以的,在Jenkins上打release包体积没有变化。也没有reports生产,这个问题找到原因了吗。

@johnsonlee
Copy link
Collaborator

Output 是 apk 还是 aab ? aab 有这个问题,在 2.4.0 已修复,APK 未发现,可可试试Booster 3.0.0

@knclj
Copy link

knclj commented Nov 9, 2020

Output是apk,发现没有包体积没有变化的时候任务是缓存解压的 Output,Gradle 将跳过pngquan压缩命令的任务执行 标志FROM-CACHE。是不是和这个有关系呢?

@johnsonlee
Copy link
Collaborator

应该和缓存有关,清下缓存试试呢?

@1982582704
Copy link

1982582704 commented Jan 5, 2022

你好,请问 集成之后,打包体积没有变化,这个问题解决了吗?
我也遇到相同的问题了,请指教。
release 包体积没有变化
debug 包提交相对来说有减少。

@johnsonlee
Copy link
Collaborator

你好,请问 集成之后,打包体积没有变化,这个问题解决了吗? 我也遇到相同的问题了,请指教。 release 包体积没有变化 debug 包提交相对来说有减少。

build 目录下的 reports 粘一下?

@electrolyteJ
Copy link

  • System version Android10

  • Java version 11

  • Gradle version 7.5

  • Android Gradle plugin version 7.4.1

  • Booster version 4.16.3

        val booster_version = "4.16.3"
        classpath("com.didiglobal.booster:booster-gradle-plugin:$booster_version")
        classpath("com.didiglobal.booster:booster-task-compression-processed-res:$booster_version")

问题:在AGP 7.4.1发现打releaase包 booster的能力不生效

解法:

org.gradle.configureondemand=true
org.gradle.caching=true
#需要关闭gradle并发模块的能力,booster打release包的过程才能生效
org.gradle.parallel=false

AGP 7.4.1中gradle并发能力默认打开,关闭就可以解决问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants