-1

I'm trying to run an old project of mine, so I imported it into Android Studio ( It used this when I originally created it ) and updated the libraries ( It wouldn't run before either )

The problem is, even though the build succeeds ( with only a warning ), I get Gradle project sync failed. and can't run it.

I'm currently running the latest alpha of gradle (2.4.0-alpha3), have tried older versions to see if that was the issue, and also tried to change the dependencies, the version, and the buildtools. I have other working projects from the same SdkVersion, so it's probably not that.

apply plugin: 'com.android.application'


android {
    compileSdkVersion 25
    buildToolsVersion '26-rc1'

    defaultConfig {
        applicationId "com.jediburrell.sof"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 7
        versionName "1.6"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile('com.github.afollestad.material-dialogs:core:0.8.5.4@aar') {
        transitive = true
    }
    compile files('libs/activation.jar')
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.android.support:design:+'
    compile 'com.android.support:cardview-v7:+'
    compile 'com.balysv:material-ripple:1.0.2'
    compile 'com.melnykov:floatingactionbutton:1.3.0'
    compile 'com.squareup.okhttp:okhttp:2.3.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.3.0'
    compile 'org.apache.httpcomponents:httpclient:+'

}

As for the warning:

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.5.3 is ignored for debug as it may be conflicting with the internal version provided by Android.
Information:BUILD SUCCESSFUL
Information:Total time: 1.27 secs
Information:0 errors
Information:1 warning
Information:See complete output in console

I have tried to build it without HttpClient. It builds the same

JediBurrell
  • 1,069
  • 10
  • 24

2 Answers2

0

Two Suggestions:

  1. Have you tried the old "Invalidate Caches/Restart IDE" Method? Or Clean Project and Rebuild? Those are my gotos for anomalous build conflicts.

  2. Try replacing the '+' in compile 'org.apache.httpcomponents:httpclient:+' with a static version of the library. Dynamic versioning on your dependencies can cause some serious undefined behavior in your builds, and can even prevent you from building/syncing your project. Here (fairly old, but relevant) is a blog post on the matter.

John Riley
  • 468
  • 1
  • 6
  • 23
  • As for 1 - I meant to mention that in the post, my bad - yes, I have done that. And regarding `HttpClient`, all of the dependencies were previously using a static version. I tried removing `HttpClient` as well as the support libraries to see if they were the problem, it still failed to sync. – JediBurrell Mar 30 '17 at 18:27
  • Hey @JediBurrel, I have a similar issue with httpclient. Have you found a solution? – Dan May 27 '17 at 14:44
  • @Dan, I ended up recreating the project and moving all the files. Started working after that. – JediBurrell May 27 '17 at 14:46
  • @Dan Didn't realize I never replied. Yes, the dependencies remained the same. Not sure why it wouldn't work before. :/ – JediBurrell Jul 21 '17 at 23:07
0

You can refer to this solution. You just have to exclude the httpclient.

 compile ('httpcomponents-httpcore:httpcore:4.0-alpha6'){
    exclude module: "httpclient"
}
Galileo
  • 321
  • 4
  • 7