问题
I am new to AndroidStudio and android programing please help me to solve my problem when I create new project on AndroidStudio v3.1.4 frist time build is started to sync after 20 seconds build sync failed and show me this error :
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.3.
and error:
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support.test:runner:1.0.2.
and Such 5 more error...
I installed latest Sdk tools and Plugins..
I try to install constraintlayout for android 1.0.2 and solver for constraintlayout from SDK tools TAB on SDK manager Check that option then apply android studio start to download and installed and after 10 seconds say that installing finished!
This means that installed successfully But when I close that window show that those option early unchecked and show status "not installed"
回答1:
I had this problem too. Turns out offline work for gradle was enabled for some reason. As such gradle is trying to get the version of constraint layout that is not cached to android studio. To enable offline work on android studio click File > Settings> Build Execution Deployment >Gradle. From there you can see a check box for offline work disable it. Hope this helps.
回答2:
this happens with last version update android, You can go back and make downgrade on packages gradle version or can, run clean builder, syncing again, if appear dependency offline from constraint, I did put here, to clean or to work offline. I don't remember now.
if you go to do the downgrade.
Normal implementation 'com.android.support:appcompat-v7:28.0.0-rc02' implementation 'com.android.support.constraint:constraint-layout:1.1.3'
Downgrade implementation 'com.android.support:appcompat-v7:28.0.0-rc01' implementation 'com.android.support.constraint:constraint-layout:1.1.2'
来源:https://stackoverflow.com/questions/52186010/failed-to-install-constraintlayout-for-android-1-0-2