Reputation: 87
I tried to implement the GridLayout by downloading it directly via android studio but I get this error:
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download gridlayout.aar (androidx.gridlayout:gridlayout:1.0.0)
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download gridlayout.aar (androidx.gridlayout:gridlayout:1.0.0)
Show Details
Affected Modules: app
I already tried to set the Global Gradle settings to offline work but a new error is displayed
ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not download gridlayout.aar (androidx.gridlayout:gridlayout:1.0.0): No cached version available for offline mode
Disable offline mode and sync project
Show Details
Affected Modules: app
Is GridLayout not yet available for android Studio?
Here is my Gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.example.android.guessit"
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//Glide maybe later add code to proguard
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
// circle imageview
implementation 'de.hdodenhof:circleimageview:3.0.0'
// cardview
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
}
Upvotes: 2
Views: 7558
Reputation: 2392
As far as I see from the warnings, nothing is wrong with gridlayout lib. If you want it to work, you need to disable Offline work from Android Studio. In order to disable it, follow the following steps:
"Gradle is in offline mode, which means that it won't go to the network to resolve dependencies. Go to Preferences > Build, Execution, Deployment > Gradle and uncheck "Offline work". In Android Studio open the settings and search for offline it will find the Gradle category which contains Offline work. You can disable it there."
Then, you may use the gridlayout
<androidx.gridlayout.widget.GridLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
Please let me know if it does not work by commenting.
Upvotes: 1