gpt4 book ai didi

android - iTextPdf-Android Studio添加库错误

转载 作者:行者123 更新时间:2023-12-02 10:50:25 26 4
gpt4 key购买 nike

我想将itext lib添加到我的项目中。(http://itextpdf.com/itextg-android)

我将jar文件添加到libs文件夹中。之后,我写了一个build.gradle:编译files('libs/itextg-5.5.4.jar')。

但是同步之后,我得到了这个错误:

Error:(12, 0) Gradle DSL method not found: 'compile()' Possible causes:

  • The project 'Pdf' may be using a version of Gradle that does not contain the method. Gradle settings
  • The build file may be missing a Gradle plugin. Apply Gradle plugin


  • 另外这里( http://www.codeproject.com/Articles/986574/Android-iText-Pdf-Example)是关于这个的解决方案,但是当我这样做时,我遇到了另一个错误

    Error:Failed to resolve: org.apache.commons:commons-imaging:1.0-SNAPSHOT Open File
    Show in Project Structure dialog

    最佳答案

    请检查是否添加了所有必需的软件包,然后,您的buil.gradle如下所示:

    apply plugin: 'com.android.application'

    android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
    applicationId "com.proyecto.alberto.monedero"
    minSdkVersion 16
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
    }
    buildTypes {
    release {
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    }
    }

    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile files('libs/itextg-5.5.4.jar')
    compile files('libs/itextg-5.5.4-sources.jar')
    compile files('libs/itextg-5.5.4-javadoc.jar')
    compile 'com.google.android.gms:play-services:7.0.0'
    }

    From: https://github.com/alonsoat/ProyectoMonedero/blob/master/app/build.gradle


    希望对你有帮助

    关于android - iTextPdf-Android Studio添加库错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35067709/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com