TinkerPatch / tinkerpatch-sdk

TinkerPatch SDK
http://tinkerpatch.com
MIT License
294 stars 56 forks source link

com.tencent.tinker.lib.service.PatchResult cannot be cast to com.tencent.tinker.lib.service.PatchResult #44

Closed ding33211 closed 6 years ago

ding33211 commented 7 years ago

异常类型:com.tencent.tinker.lib.service.PatchResult cannot be cast to com.tencent.tinker.lib.service.PatchResult

手机型号:OPPO R11

手机系统版本:Android 7.1.1

tinker版本:latest

gradle版本:3.3

是否使用热更新SDK:TinkerPatch SDK

系统:Mac

堆栈/日志: image

ding33211 commented 7 years ago

https://github.com/Tencent/tinker/issues/591

simpleton commented 7 years ago

@ding33211 麻烦问下使用的是什么版本?

ding33211 commented 7 years ago

@simpleton 使用的是当前最新版本 1.1.8

simpleton commented 7 years ago

是否必先么?可否贴一下相关配置?

ding33211 commented 7 years ago

必现,目前来看,在上面的tinker issue链接,也有同仁遇到了一样的问题

ding33211 commented 7 years ago

@simpleton

project    build.gradle

dependencies {
        classpath 'com.android.tools.build:gradle:' + project.ANDROID_GRADLE_TOOL_VERSION
        ...

        // TinkerPatch 插件
        classpath "com.tinkerpatch.sdk:tinkerpatch-gradle-plugin:1.1.8"
}

module  build.gradle
//tinker patch 热修复相关
apply from: 'tinkerpatch.gradle'

dependencies {
    compile fileTree(include: '*.jar', dir: 'src/main/jniLibs')
    ...
    // 热修复 tinker
    compile 'com.tinkerpatch.sdk:tinkerpatch-android-sdk:1.1.8'
}

就是按照说明配置来的

apply plugin: 'tinkerpatch-support'

def bakPath = file("${rootDir}/app/previousApk/")
def diffPath = file("${rootDir}/app/wannerDiffForHotfix/")
def variantName = "release"

/**
 * 对于插件各参数的详细解析请参考
 * http://tinkerpatch.com/Docs/SDK
 */
tinkerpatchSupport {
    /** 可以在debug的时候关闭 tinkerPatch **/
    /** 当disable tinker的时候需要添加multiDexKeepProguard和proguardFiles,
     这些配置文件本身由tinkerPatch的插件自动添加,当你disable后需要手动添加
     你可以copy本示例中的proguardRules.pro和tinkerMultidexKeep.pro,
     需要你手动修改'tinker.sample.android.app'本示例的包名为你自己的包名, com.xxx前缀的包名不用修改
     **/
    tinkerEnable = true
    reflectApplication = true

    autoBackupApkPath = "${bakPath}"

    appKey = "*************"    //使用公司账户key

    /** 注意: 若发布新的全量包, appVersion一定要更新 **/
    appVersion = gitVersionBranch()

    def pathPrefix = "${diffPath}"
    def name = "${project.name}-home-${variantName}"

    baseApkFile = "${pathPrefix}/${name}.apk"
    baseProguardMappingFile = "${pathPrefix}/${name}-mapping.txt"
    baseResourceRFile = "${pathPrefix}/${name}-R.txt"

    /**
     *  若有编译多flavors需求, 可以参照: https://github.com/TinkerPatch/tinkerpatch-flavors-sample
     *  注意: 除非你不同的flavor代码是不一样的,不然建议采用zip comment或者文件方式生成渠道信息(相关工具:walle 或者 packer-ng)
     **/

//    productFlavors {
//        flavor {
//            flavorName = "home"
//            // 后台需要按照每个flavor的appVersion来建立独立的工程,并单独下发补丁
//            appVersion = "${tinkerpatchSupport.appVersion}_${flavorName}"
//
//            pathPrefix = "${bakPath}"
//            name = "${project.name}-${flavorName}-${variantName}"
//
//            baseApkFile = "${pathPrefix}/${name}.apk"
//            baseProguardMappingFile = "${pathPrefix}/${name}-mapping.txt"
//            baseResourceRFile = "${pathPrefix}/${name}-R.txt"
//        }
//    }
}

/**
 * 用于用户在代码中判断tinkerPatch是否被使能
 */
android {
    defaultConfig {
        buildConfigField "boolean", "TINKER_ENABLE", "${tinkerpatchSupport.tinkerEnable}"
    }
}

/**
 * 一般来说,我们无需对下面的参数做任何的修改
 * 对于各参数的详细介绍请参考:
 * https://github.com/Tencent/tinker/wiki/Tinker-%E6%8E%A5%E5%85%A5%E6%8C%87%E5%8D%97
 */
tinkerPatch {
    ignoreWarning = false
    useSign = true
    dex {
        dexMode = "jar"
        pattern = ["classes*.dex"]
        loader = []
    }
    lib {
        pattern = ["lib/*/*.so"]
    }

    res {
        pattern = ["res/*", "r/*", "assets/*", "resources.arsc", "AndroidManifest.xml"]
        ignoreChange = []
        largeModSize = 100
    }

    packageConfig {
    }
    sevenZip {
        zipArtifact = "com.tencent.mm:SevenZip:1.1.10"
//        path = "/usr/local/bin/7za"
    }
    buildConfig {
        keepDexApply = false
    }
}

def gitVersionBranch() {
    def cmd = 'git symbolic-ref --short HEAD' //git describe --tags'
    def version = cmd.execute().text.trim()

    def _index = version.indexOf("_")

    if(_index > 5) {
        version = version.substring(5, _index);
    } else {
        version = version.substring(5)
    }

    println version
    return version
}
simpleton commented 7 years ago

不是这个配置,是tinkerpatchsupport的,你的sample可以跑通么?

On Sep 6, 2017 6:33 PM, wrote:

那个很早就close了,是因为1.0.0的版本的一键接入在Android N上有问题

On Sep 6, 2017 6:30 PM, "Super Shanks" notifications@github.com wrote:

@simpleton https://github.com/simpleton

project build.gradle

dependencies { classpath 'com.android.tools.build:gradle:' + project.ANDROID_GRADLE_TOOL_VERSION ...

    // TinkerPatch 插件
    classpath "com.tinkerpatch.sdk:tinkerpatch-gradle-plugin:1.1.8"

}

module build.gradle //tinker patch 热修复相关 apply from: 'tinkerpatch.gradle'

dependencies { compile fileTree(include: '*.jar', dir: 'src/main/jniLibs') ... // 热修复 tinker compile 'com.tinkerpatch.sdk:tinkerpatch-android-sdk:1.1.8' }

就是按照说明配置来的

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TinkerPatch/tinkerpatch-sdk/issues/44#issuecomment-327443415, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbvYvhFF09Py0g5wd5kJriLIMl9qLXDks5sfnRKgaJpZM4PMz81 .

simpleton commented 7 years ago

那个很早就close了,是因为1.0.0的版本的一键接入在Android N上有问题

On Sep 6, 2017 6:30 PM, "Super Shanks" notifications@github.com wrote:

@simpleton https://github.com/simpleton

project build.gradle

dependencies { classpath 'com.android.tools.build:gradle:' + project.ANDROID_GRADLE_TOOL_VERSION ...

    // TinkerPatch 插件
    classpath "com.tinkerpatch.sdk:tinkerpatch-gradle-plugin:1.1.8"

}

module build.gradle //tinker patch 热修复相关 apply from: 'tinkerpatch.gradle'

dependencies { compile fileTree(include: '*.jar', dir: 'src/main/jniLibs') ... // 热修复 tinker compile 'com.tinkerpatch.sdk:tinkerpatch-android-sdk:1.1.8' }

就是按照说明配置来的

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TinkerPatch/tinkerpatch-sdk/issues/44#issuecomment-327443415, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbvYvhFF09Py0g5wd5kJriLIMl9qLXDks5sfnRKgaJpZM4PMz81 .

ding33211 commented 7 years ago

后面有tinkerpatchsupport的,你看下是由什么问题么

simpleton commented 7 years ago

@ding33211 从配置上看没有错误,这个错误是指在oppo r11这一款机器必现么?可否把你的基础包发我邮箱,我debug一下。

PS:可否麻烦您尝试一下sample是否也会出现问题

ding33211 commented 7 years ago

这边没有OPPO r11的手机,暂时无法尝试sample是否会有问题,从bugly上来看是必现,每天都稳定提供崩溃 image

应该不是指定的应用会崩溃,tinker的奔溃链接中也看到有其他的用户也遇到了这样的问题

ding33211 commented 7 years ago

@simpleton 基础包已经发到你邮箱,可以看下