Search code examples
android-studioandroid-gradle-pluginbuilding

Configuring Gradle for iosched 2013 source from Android Studio


Android developer noobie here.

I got the latest iosched 2013 source and resolved most of the issues and edited the Gradle file accordingly (at least I think I am on the right track).

I can now launch the app in an AVD. Mostly resolved by:

  1. Running the SDK Manager and including the libraries I figured out
  2. Editing the Gradle file as below.

When I go to Build > Clean Project, it says Gradle invocation completeed succesfully

But the following lines are underlined from within Android Studio:

compile 'com.google.android.apps.dashclock:dashclock-api:+'
compile 'com.google.code.gson:gson:2.+'

exclude group: 'org.apache.httpcomponents', module: 'httpclient'
compile 'com.google.apis:google-api-services-plus:+'

Gradle Source:

/*
 * Copyright 2013 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

apply plugin: 'android'

repositories {
    mavenCentral()
}

    dependencies {
        compile 'com.google.android.gms:play-services:3.+'
        compile 'com.android.support:appcompat-v7:19.1.0'
        compile 'com.google.android.apps.dashclock:dashclock-api:+' // underlined from dashclock:dashclock-api:+ 
        compile 'com.google.code.gson:gson:2.+' // underlined from gson:gson:2.+'
        compile('com.google.api-client:google-api-client:1.+') {
            exclude group: 'xpp3', module: 'shared'
            exclude group: 'org.apache.httpcomponents', module: 'httpclient' // underlined from httpcomponents', module: 'httpclient'
            exclude group: 'junit', module: 'junit'
            exclude group: 'com.google.android', module: 'android'
        }
        compile 'com.google.api-client:google-api-client-android:1.17.+'
        compile 'com.google.apis:google-api-services-plus:+' // underlined from apis:google-api-services-plus:+'
        compile fileTree(dir: 'libs', include: '*.jar')
    }

    android {
        compileSdkVersion 19
        buildToolsVersion "19.0.0"

        defaultConfig {
            minSdkVersion 10
            targetSdkVersion 19
        }
    }

Help would be most appreciated.

Thank-you!


EDIT

Added screenshots of what I mean

gson

apis dashlock

httpcomponents


Solution

  • Those warnings (not errors) are totally fine. In fact, I'd recommend you turning this warning off, as 90% of the time it is a false positive.

    To turn off the warning, go to File -> Settings -> Inspections, and search for 'Spelling'. Untick the results, and click Ok. The warnings will disappear.


    Bottom line: If there are no other errors, you should be able to build an run the application. These warnings should not prevent that.