How to add POI Android in Android Studio?

点点圈 提交于 2021-01-29 08:12:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!