问题
I'd like to add POI Android in to Android Studio. The gradle code is this:
implementation "com.github.SUPERCILEX.poi-android:poi:$poiVersion"
But i only get this message:
Could not get unknown property 'poiVersion' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Could you help me?
回答1:
Open your project-level build.gradle
file.
Add below code snippet:
allprojects {
repositories {
// ...
maven { url 'https://jitpack.io' }
}
}
Then, inside buildscript, add an object ext
as below. Now, define a attribute as poiVersion
and assign the value 3.17
to it.
This is similar to defining a variable with name as "poiVersion" and assigning value as "3.17"
buildscript {
repositories {
...
}
ext {
poiVersion = '3.17'
}
dependencies {
...
}
}
And to access that variable you can use ${variable_name} as in your case, you used $poiVersion
回答2:
$poiVersion is a placeholder. You need to replace it with a particular version
来源:https://stackoverflow.com/questions/52757792/how-to-add-poi-android-in-android-studio