2016-09-21 1 views
3

Использование gradle-lint-plugin в Android Studio, он намекает, чтоДолжен ли я переместить некоторые зависимости в «runtime» в Gradle в Android Studio?

:lintGradle 

This project contains lint violations. A complete listing of the 
violations follows. Because none were serious, the build's overall 
status was unaffected. 

this dependency should be moved to the runtime configuration since it 
has no classes warning unused-dependency     
app/build.gradle:43 compile 'com.android.support:appcompat-v7:24.1.0' 

this dependency should be moved to the runtime configuration since it 
has no classes warning unused-dependency     
app/build.gradle:44 compile 'com.android.support:design:24.1.0' 

this dependency should be moved to the runtime configuration since it 
has no classes warning unused-dependency     
app/build.gradle:45 compile 'com.android.support:cardview-v7:24.1.0' 

this dependency should be moved to the runtime configuration since it 
has no classes warning unused-dependency     
app/build.gradle:52 compile 
'com.github.gigamole.arcprogressstackview:library:+' 

this dependency should be moved to the runtime configuration since it 
has no classes warning unused-dependency     
app/build.gradle:53 compile 'com.github.dexafree:materiallist:3.2.1' 

this dependency should be moved to the runtime configuration since it 
has no classes warning unused-dependency     
app/build.gradle:54 compile 'com.android.volley:volley:1.0.0' 

this dependency should be moved to the runtime configuration since it 
has no classes warning unused-dependency     
app/build.gradle:55 compile 'com.cocosw:bottomsheet:[email protected]' 

this dependency should be moved to the runtime configuration since it 
has no classes warning unused-dependency     
app/build.gradle:57 compile 'com.android.support:support-v4:+' 

this dependency should be moved to the runtime configuration since it 
has no classes warning unused-dependency     
app/build.gradle:58 compile 'com.github.shem8:material-login:1.4.0' 

this dependency should be moved to the runtime configuration since it 
has no classes warning unused-dependency     
app/build.gradle:64 
compile('com.github.ozodrukh:CircularReveal:[email protected]') { 
    transitive = true; } 

this dependency should be moved to the runtime configuration since it 
has no classes warning unused-dependency     
app/build.gradle:74 compile 'com.github.rey5137:material:1.2.4' 

? app/build.gradle: 11 problems (0 errors, 11 warnings) 

To apply fixes automatically, run fixGradleLint, review, and commit 
the changes. 


BUILD SUCCESSFUL 

Должен ли я взять совет? Если эти зависимости должны быть в runtime, почему каждая зависимость wiki/doc не говорит об этом и настаивает на том, что нам нужно устанавливать зависимости в compile?

Редактировать: Я пытаюсь принять совет, другими словами, сменить ключевое слово compile на runtime, например runtime 'com.android.support:appcompat-v7:24.1.0'. Тем не менее, Android Studio намекает, что

Error:Could not find method runtime() for arguments 
[com.android.support:appcompat-v7:24.1.0] on object of type 
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. 

Please install the Android Support Repository from the Android SDK 
Manager. <a href="openAndroidSdkManager">Open Android SDK Manager</a> 

Так в чем проблема?

ответ

0

Вы должны установить зависимости, необходимые для компиляции, в compile, включая классы, которые вы используете непосредственно в своих источниках.

Вы должны установить зависимости, которые вам не нужны для компиляции, но нужны во время выполнения в runtime, они недоступны в пути к компиляции, но они будут доступны при выполнении.

+0

см. Обновление пожалуйста. – guo

+0

Хм, странно. Может быть, вы должны опубликовать свой 'build.gradle' – Vampire

1

Я считаю, что apk является андроид для runtime, например .:

apk 'com.android.support:appcompat-v7:24.1.0' 

Некоторые говорят package

https://stackoverflow.com/a/28473873/360211

Может быть и работа, может быть, нет никакой разницы, может быть, есть. Я не знаю, как очень неопределенные термины.

Смежные вопросы