didi / VirtualAPK

A powerful and lightweight plugin framework for Android
Apache License 2.0
8.99k stars 1.52k forks source link

插件项目构建失败 #278

Open 994866755 opened 6 years ago

994866755 commented 6 years ago

classpath 'com.android.tools.build:gradle:3.1.2' 和 classpath 'com.android.tools.build:gradle:3.0.0' 都试过

VirtualAPK 版本 classpath 'com.didi.virtualapk:gradle:0.9.8.6'

gradlew clean assemblePlugin 之后报错 Cannot get property 'id' on null object 这是什么原因

完整日志 D:\VirtualAPKTest>gradlew clean assemblePlugin Starting a Gradle Daemon, 1 incompatible and 10 stopped Daemons could not be reused, use --status for details

Configure project :app Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.

Configure project :plugintest [INFO][VAPlugin] Evaluating VirtualApk's configurations...

Task :plugintest:preReleaseBuild [INFO][PrepareDependenciesHooker] Need strip aar: com.android.support:appcompat-v7:23.4.0 [INFO][PrepareDependenciesHooker] Need strip aar: com.android.support:animated-vector-drawable:23.4.0 [INFO][PrepareDependenciesHooker] Need strip aar: com.android.support:support-vector-drawable:23.4.0 [INFO][PrepareDependenciesHooker] Need strip aar: com.android.support:support-v4:23.4.0 [INFO][PrepareDependenciesHooker] Need strip jar: com.android.support:support-annotations:23.4.0 [INFO][AarDependenceInfo] Found [com.android.support:appcompat-v7:23.4.0@aar]'s jar file: C:\Users\Administrator.gradle\caches\transforms-1\files-1.1\appcompat-v7-23.4.0.aar\1efc64fb89ac6c281bfed235352e8490\jars\classes.jar [INFO][AarDependenceInfo] Found [com.android.support:animated-vector-drawable:23.4.0@aar]'s jar file: C:\Users\Administrator.gradle\caches\transforms-1\files-1.1\animated-vector-drawable-23.4.0.aar\8f92b116a8c7a70e62e91da109938a37\jars\classes.jar [INFO][AarDependenceInfo] Found [com.android.support:support-vector-drawable:23.4.0@aar]'s jar file: C:\Users\Administrator.gradle\caches\transforms-1\files-1.1\support-vector-drawable-23.4.0.aar\fcc0cdd033b21b83a50fbeb2b487acf8\jars\classes.jar [INFO][AarDependenceInfo] Found [com.android.support:support-v4:23.4.0@aar]'s jar file: C:\Users\Administrator.gradle\caches\transforms-1\files-1.1\support-v4-23.4.0.aar\9a7ac45453b4fde3e5149b813878f7c6\jars\classes.jar [INFO][JarDependenceInfo] Found [com.android.support:support-annotations:23.4.0@jar]'s jar file: D:\SDK\extras\android\m2repository\com\android\support\support-annotations\23.4.0\support-annotations-23.4.0.jar [INFO][PrepareDependenciesHooker] Analyzed all dependencis. Get more infomation in dir: D:\VirtualAPKTest\plugintest\build\intermediates\virtualapk\release

Task :plugintest:processReleaseManifest [INFO][MergeManifestsHooker] Stripped manifest of artifact: AndroidManifest.xml (com.android.support:appcompat-v7:23.4.0) -> C:\Users\Administrator.gradle\caches\transforms-1\files-1.1\appcompat-v7-23.4.0.aar\1efc64fb89ac6c281bfed235352e8490\AndroidManifest.xm l [INFO][MergeManifestsHooker] Stripped manifest of artifact: AndroidManifest.xml (com.android.support:animated-vector-drawable:23.4.0) -> C:\Users\Administrator.gradle\caches\transforms-1\files-1.1\animated-vector-drawable-23.4.0.aar\8f92b116a8c7a70e62e91da1099 38a37\AndroidManifest.xml [INFO][MergeManifestsHooker] Stripped manifest of artifact: AndroidManifest.xml (com.android.support:support-vector-drawable:23.4.0) -> C:\Users\Administrator.gradle\caches\transforms-1\files-1.1\support-vector-drawable-23.4.0.aar\fcc0cdd033b21b83a50fbeb2b487a cf8\AndroidManifest.xml [INFO][MergeManifestsHooker] Stripped manifest of artifact: AndroidManifest.xml (com.android.support:support-v4:23.4.0) -> C:\Users\Administrator.gradle\caches\transforms-1\files-1.1\support-v4-23.4.0.aar\9a7ac45453b4fde3e5149b813878f7c6\AndroidManifest.xml

FAILURE: Build failed with an exception.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0. See https://docs.gradle.org/4.6/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 14s 15 actionable tasks: 14 executed, 1 up-to-date

详细错误日志

994866755 commented 6 years ago

是不是因为我的xml名叫activity_main导致的

zhangbaogithub commented 5 years ago

我也遇到了同样的问题,请问你解决了吗

supermavericks commented 5 years ago

same question.

supermavericks commented 5 years ago

是不是因为我的xml名叫activity_main导致的 yeah,

bovyoung commented 5 years ago

我也遇到相同的问题,不清楚这个为啥拿不到这个属性。

BeQuietLee commented 5 years ago

你在插件工程的app/build.gradle文件中,dependencies{}里面增加 implementation 'com.android.support:appcompat-v7:23.4.0'试试,我也遇到一样的报错,是这么解决的。 根本原因未明

PhantomQi commented 5 years ago

根据源码的含义,一种可能性是:插件中所有的资源,都在宿主中有出现,导致处理插件资源的时候,发现没有资源可处理了,而VA并没有很好的处理这种情况,于是就NPE了。 导致这种情况出现的一种可能是:如果是一个拥有多个子工程的项目,宿主和插件的依赖配置可能出错了,可以检查一下。

BeQuietLee commented 5 years ago

根据源码的含义,一种可能性是:插件中所有的资源,都在宿主中有出现,导致处理插件资源的时候,发现没有资源可处理了,而VA并没有很好的处理这种情况,于是就NPE了。 导致这种情况出现的一种可能是:如果是一个拥有多个子工程的项目,宿主和插件的依赖配置可能出错了,可以检查一下。

同意你的观点,这可能是一个bug。

lizijin commented 5 years ago

我的解决方案是把插件项目中的所有资源文件加个前缀。

WeNoteBB commented 5 years ago

插件里面,不要有activity_main和MainActivity,换个名字即可