且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Android Studio中添加Android POI?

更新时间:2023-01-04 08:46:31

打开项目级别的 build.gradle 文件.

添加以下代码段:

allprojects {
    repositories {
        // ...
        maven { url 'https://jitpack.io' }
    }
}

然后在buildscript中,添加一个对象 ext ,如下所示.现在,将属性定义为 poiVersion 并为其分配值 3.17 .

Then, inside buildscript, add an object ext as below. Now, define a attribute as poiVersion and assign the value 3.17 to it.

这类似于定义名称为"poiVersion"的变量并将值分配为"3.17"

This is similar to defining a variable with name as "poiVersion" and assigning value as "3.17"

buildscript {
    repositories {
        ...
    }

    ext {
        poiVersion = '3.17'
    }

    dependencies {
        ...
    }
}

要访问该变量,您可以使用$ {variable_name},如您的情况,您可以使用 $ poiVersion

And to access that variable you can use ${variable_name} as in your case, you used $poiVersion