【问题标题】:How can I use com.github.barteksc:android-pdf-viewer in a tv app?如何在电视应用程序中使用 com.github.barteksc:android-pdf-viewer?
【发布时间】:2022-12-11 05:24:24
【问题描述】:

无法解决:com.github.barteksc:android-pdf-viewer:3.2.0-beta.1 尝试将包添加为依赖项时。 还尝试将 jCentre 添加为存储库,但这没有用。

任何其他包的建议也可以。

项目级别 gradle -

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.2.1' apply false
    id 'com.android.library' version '7.2.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

模块级 gradle -

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.example.myapplication"
        minSdk 21
        targetSdk 32
        versionCode 1
        versionName "1.0"

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    buildFeatures {
        viewBinding true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.leanback:leanback:1.0.0'
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    implementation 'androidx.appcompat:appcompat:1.4.2'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2'
    implementation 'androidx.navigation:navigation-ui-ktx:2.4.2'
    implementation 'com.github.bumptech.glide:glide:4.13.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.13.0'
    implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1'
}

设置.gradle -

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}
rootProject.name = "####"
include ':app'

提前致谢

【问题讨论】:

  • 您好,您可以分享您的模块和项目的 gradles 吗?
  • 而不是 jCenter 使用 mavenCentral()
  • 嗨@TicherhazFreePalestine 我已经用两个 gradles 更新了我的问题
  • @Amartya 你也可以分享你的 settings.gradle 吗?
  • @TicherhazFreePalestine 分享了 settings.gradle

标签: android pdf android-tv pdf-viewer


【解决方案1】:

将您的setting.gradle 编辑为以下内容:

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
        jcenter()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
}
rootProject.name = "####"
include ':app'

在您的布局中包含 PDFView:

<com.github.barteksc.pdfviewer.PDFView
        android:id="@+id/pdfView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

【讨论】:

    猜你喜欢
    • 2018-05-04
    • 1970-01-01
    • 2022-06-23
    • 1970-01-01
    • 2018-08-14
    • 2015-08-06
    • 1970-01-01
    • 2014-05-17
    • 2015-11-24
    相关资源
    最近更新 更多