简体   繁体   中英

location gradle dependencies / android studio plugin, Android Studio 1.3

Looking at my build.gradle file (module:app, modified from the FragmentBasics example code) - where is the android plugin ('com.android.application')? - Where are the dependencies (eg "com.android.support:support-v4:22.2.0")? - are these in Maven Central Repository or local? I'm asking because I've had to meddle with the file names to get this project to build (eg the first version of com.android.support:support-v4 I tried would not build with my target sdk) - so I'm guessing future changes may break my build (correct?) and would like to get in early here. Also, are there different names for the android plugin (eg older names) in example code around the place? Has the name of the plugin changed over time (again, just wondering if future name changes here might break my build)?

Thanks

My build.gradle file for reference:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "website.[...].FragmentBasics"
        minSdkVersion 7
        targetSdkVersion 22
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:22.+'
    compile "com.android.support:support-v4:22.2.0"
    compile "com.android.support:appcompat-v7:22.2.0"
    compile "com.android.support:support-annotations:22.2.0"
}

look at YourAppFile\\.idea\\libraries... your libraries will be here as .xml and if you wanna know where are they, you can open xml files which do you wanna. it will be like that (are dependencies)

<component name="libraryTable">
  <library name="support-annotations-22.2.0">
    <CLASSES>
      <root url="jar://$USER_HOME$/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/22.2.0/support-annotations-22.2.0.jar!/" />
    </CLASSES>
    <JAVADOC />
    <SOURCES>
      <root url="jar://$USER_HOME$/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/22.2.0/support-annotations-22.2.0-sources.jar!/" />
    </SOURCES>
  </library>
</component>

but I dunno where apply plugin "com.android bla bla bla ...

Android support library is not in maven center, it's in your android sdk. Open Android SDK Manager , you can check it: 在此处输入图片说明

If you're using newer versions of Android Studio, Gradle will look for your dependencies in the JCenter repository rather than Maven Central. Basically JCenter is a superset of Maven Central, that encompasses many additional repositories and artifacts. Also, JCenter has a better performance than Maven Central.

If you don't update the versions of external dependencies, Gradle plugin and targetSdkVersion etc, your project will always be able to build.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM