Android的依赖被忽略发布Android

2023-09-04 10:49:36 作者:塌上青丝

我得到了很多这些警告与摇篮建设我的项目时。我看到 http://stackoverflow.com/a/15794650/864069 ,但我不清楚如何平息这些。这听起来像 任何版本的这些事情,我根据所得到剥离出来有利于包装的android.jar版本。

我想没关系,但我真的想这样的事情,我看到的是真正的问题,关闭这些只占。

那么,具体地讲,我很好奇:

这是否说明一个问题?好像绝对不是。 如何关闭这个吗? 在不大家看到这一套警告?我是持怀疑态度的人的整个宇宙用摇篮+ android.Log是看到这套警告。

 警告:依赖共享记录:共享记录:1.1.1被忽略的调试,因为它可以与搭载Android提供的内部版本冲突。
         如遇问题,请及时与jarjar重新包装更改类包
警告:依赖共享记录:共享记录:1.1.1被忽略的调试,因为它可能是相互冲突与机器人提供的内​​部版本。
         如遇问题,请及时与jarjar重新包装更改类包
警告:依赖共享记录:共享记录:1.1.1被忽略的释放,因为它可能是相互冲突与机器人提供的内​​部版本。
         如遇问题,请及时与jarjar重新包装更改类包
警告:依赖共享记录:共享记录:1.1.1被忽略的释放,因为它可能是相互冲突与机器人提供的内​​部版本。
         如遇问题,请及时与jarjar重新包装更改类包
警告:依赖共享记录:共享记录:1.1.1被忽略的DebugTest,因为它可能是相互冲突与机器人提供的内​​部版本。
         如遇问题,请及时与jarjar重新包装更改类包
警告:依赖共享记录:共享记录:1.1.1被忽略的DebugTest,因为它可能是相互冲突与机器人提供的内​​部版本。
         如遇问题,请及时与jarjar重新包装更改类包
警告:依赖共享记录:共享记录:1.1.1被忽略robolectric,因为它可以与搭载Android提供的内部版本冲突。
         如遇问题,请及时与jarjar重新包装更改类包
警告:依赖共享记录:共享记录:1.1.1被忽略robolectric,因为它可以与搭载Android提供的内部版本冲突。
         如遇问题,请及时与jarjar重新包装更改类包
警告:依赖共享记录:共享记录:1.1.1被忽略的调试,因为它可能是相互冲突与机器人提供的内​​部版本。
         如遇问题,请及时与jarjar重新包装更改类包
警告:依赖共享记录:共享记录:1.1.1被忽略的调试,因为它可能是相互冲突与机器人提供的内​​部版本。
         如遇问题,请及时与jarjar重新包装更改类包
警告:依赖共享记录:共享记录:1.1.1被忽略的释放,因为它可能是相互冲突与机器人提供的内​​部版本。
         如遇问题,请及时与jarjar重新包装更改类包
警告:依赖共享记录:共享记录:1.1.1被忽略的释放,因为它可能是相互冲突与机器人提供的内​​部版本。
         如遇问题,请及时与jarjar重新包装更改类包
警告:依赖共享记录:共享记录:1.1.1被忽略的DebugTest,因为它可能是相互冲突与机器人提供的内​​部版本。
         如遇问题,请及时与jarjar重新包装更改类包
警告:依赖org.apache.httpcomponents:httpclient的:4.0.3将被忽略的DebugTest,因为它可以与由机器人提供的内​​部版本冲突。
         如遇问题,请及时与jarjar重新包装更改类包
 

解决方案

我不能确定这是否可以创造的问题。做的最好的事情是遵循建议的警告,或者完全排除相关性(你点#2,我已经回答了如下)。

我已经看到这些警告为好,特别是共享记录之一。

在什么您链接也跟它的线程的答案是,你应该忽略这些依赖关系,因为Android的API包括他们已经(我想,纠正我,如果我错了)。

有关,如果你特别需要共享记录(或其他,给出了一个类似的警告)从列表中删除。例如

build.gradle文件:

 相关性{
    ...
    编译共享记录:共享记录:1.1.3#Remove这一行;你不需要它。
    ....
}
 
android 添加依赖库,发布Android开源库android library,并通过添加依赖的方式使用

另外,如果你有一种依赖,需要共享记录作为一个传递依赖,你应该排除它。

例如:

 相关性{
    ...
    编译some.package.that:requires_commons_logging:1.2.3
    ....
}
 

变为

 相关性{
    ...
    编译(some.package.that:requires_commons_logging:1.2.3'){
        排除组:共享记录',模块:共享记录
    }
    ....
}
 

这是简单的方法来完全排除它可以通过添加到您build.gradle文件,以及完成,而不必排除它在每个依赖:

 配置{
    所有* .exclude组:共享记录',模块:共享记录
}
 

最后,要查看依赖关系树(并查看您的每一个依赖于自己的传递性地导入可发生冲突,这是非常有用的),使用此命令从项目的根目录下:

  ./ gradlew:your_module_name:相关性
 

I get a lot of these warnings when building my project with gradle. I see http://stackoverflow.com/a/15794650/864069, but I'm unclear how to silence these. It sounds like any version of these things I'm depending on is getting stripped out in favor of the version packaged in android.jar.

I suppose that's okay, but I really would like to shut these up so that the things I see are real problems only.

So, specifically, I'm curious:

Does this indicate an issue? Seems like definitely not. How do I shut this up? Doesn't everyone see this set of warnings? I'm skeptical that the entire universe of people using gradle + android.Log is seeing this set of warnings.

WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debugTest as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debugTest as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for robolectric as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for robolectric as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debugTest as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.3 is ignored for debugTest as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages

解决方案

I'm unsure if this can create issues. The best thing to do is to follow the suggestion in the warning, or exclude the dependency entirely (your point #2, which I've answered below).

I've been seeing these warnings as well, specifically the 'commons-logging' one.

What the answer in the thread you linked too is saying is that you should ignore these dependencies since the Android APIs include them already (I think. Correct me if I'm wrong).

For example if you are specifically requiring commons-logging (or another that gives a similar warning) remove it from your list.

build.gradle file:

dependencies {
    ...
    compile 'commons-logging:commons-logging:1.1.3' #Remove this line; you don't need it.
    ....
}

Also, if you have a dependency that requires commons-logging as a transitive dependency, you should exclude it as well.

Example:

dependencies {
    ...
    compile 'some.package.that:requires_commons_logging:1.2.3'
    ....
}

becomes

dependencies {
    ...
    compile ('some.package.that:requires_commons_logging:1.2.3') {
        exclude group: 'commons-logging', module: 'commons-logging'
    }
    ....
}

An easy way to completely exclude it can be done by adding this to your build.gradle file as well, without having to exclude it in each dependency:

configurations {
    all*.exclude group: 'commons-logging', module: 'commons-logging'
}

Finally, to view the dependency tree (and to see what each of your dependencies transitively import on their own which can conflict, which can be very useful), use this command from the root of your project:

./gradlew :your_module_name:dependencies