当前位置: 首页 > wzjs >正文

网站百度多久做一次排名大型seo公司

网站百度多久做一次排名,大型seo公司,公众号网站制作,有什么免费企业网站是做企业黄页的PDFView 是一个用于在 Android 应用中显示 PDF 文档的库。它提供了丰富的功能和灵活的配置选项,使得开发者能够轻松地在应用中嵌入 PDF 阅读器。 一、 添加依赖 在模块的 build.gradle 文件中添加以下依赖: // pdfimplementation("com.github.bar…

PDFView 是一个用于在 Android 应用中显示 PDF 文档的库。它提供了丰富的功能和灵活的配置选项,使得开发者能够轻松地在应用中嵌入 PDF 阅读器。

一、 添加依赖

  • 模块的 build.gradle 文件中添加以下依赖:
	// pdfimplementation("com.github.barteksc:android-pdf-viewer:3.2.0-beta.1")

二、添加 阿里云 Maven 仓库

  • 此时编译时会报错,提示无法找到该库
* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.> Could not find com.github.barteksc:android-pdf-viewer:3.2.0-beta.1.Searched in the following locations:- https://dl.google.com/dl/android/maven2/com/github/barteksc/android-pdf-viewer/3.2.0-beta.1/android-pdf-viewer-3.2.0-beta.1.pom- https://repo.maven.apache.org/maven2/com/github/barteksc/android-pdf-viewer/3.2.0-beta.1/android-pdf-viewer-3.2.0-beta.1.pomRequired by:project :app
  • 在项目的 settings.gradle.kts 文件中增加 阿里云 Maven 仓库 支持。
dependencyResolutionManagement {repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)repositories {google()mavenCentral()// 阿里云 Maven 仓库maven { url = uri("https://maven.aliyun.com/repository/google") }maven { url = uri("https://maven.aliyun.com/repository/gradle-plugin") }maven { url = uri("https://maven.aliyun.com/repository/public") }maven { url = uri("https://maven.aliyun.com/repository/central") }}
}

三、解决库冲突问题

  • 下载 android-pdf-viewer 依赖库后,编译提示 “com.android.support” 库冲突:
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable> Duplicate class android.support.v4.app.AppLaunchChecker found in modules support-compat-28.0.0.aar -> support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0) and support-core-utils-26.1.0.aar -> support-core-utils-26.1.0-runtime (com.android.support:support-core-utils:26.1.0)Duplicate class android.support.v4.app.FrameMetricsAggregator found in modules support-compat-28.0.0.aar -> support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0) and support-core-utils-26.1.0.aar -> support-core-utils-26.1.0-runtime (com.android.support:support-core-utils:26.1.0)Duplicate class android.support.v4.app.FrameMetricsAggregator$FrameMetricsApi24Impl found in modules support-compat-28.0.0.aar -> support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0) and support-core-utils-26.1.0.aar -> support-core-utils-26.1.0-runtime (com.android.support:support-core-utils:26.1.0)Duplicate class android.support.v4.app.FrameMetricsAggregator$FrameMetricsApi24Impl$1 found in modules support-compat-28.0.0.aar -> support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0) and support-core-utils-26.1.0.aar -> support-core-utils-26.1.0-runtime (com.android.support:support-core-utils:26.1.0)Duplicate class android.support.v4.app.FrameMetricsAggregator$FrameMetricsBaseImpl found in modules support-compat-28.0.0.aar -> support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0) and support-core-utils-26.1.0.aar -> support-core-utils-26.1.0-runtime (com.android.support:support-core-utils:26.1.0)Duplicate class android.support.v4.app.FrameMetricsAggregator$MetricType found in modules support-compat-28.0.0.aar -> support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0) and support-core-utils-26.1.0.aar -> support-core-utils-26.1.0-runtime (com.android.support:support-core-utils:26.1.0)Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.13.1.aar -> core-1.13.1-runtime (androidx.core:core:1.13.1) and support-compat-28.0.0.aar -> support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules core-1.13.1.aar -> core-1.13.1-runtime (androidx.core:core:1.13.1) and support-compat-28.0.0.aar -> support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules core-1.13.1.aar -> core-1.13.1-runtime (androidx.core:core:1.13.1) and support-compat-28.0.0.aar -> support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)Duplicate class android.support.v4.app.NavUtils found in modules support-compat-28.0.0.aar -> support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0) and support-core-utils-26.1.0.aar -> support-core-utils-26.1.0-runtime (com.android.support:support-core-utils:26.1.0)Duplicate class android.support.v4.app.TaskStackBuilder found in modules support-compat-28.0.0.aar -> support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0) and support-core-utils-26.1.0.aar -> support-core-utils-26.1.0-runtime (com.android.support:support-core-utils:26.1.0)......Duplicate class androidx.versionedparcelable.VersionedParcelParcel found in modules versionedparcelable-1.1.1.aar -> versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0.aar -> versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)Duplicate class androidx.versionedparcelable.VersionedParcelStream found in modules versionedparcelable-1.1.1.aar -> versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0.aar -> versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)Duplicate class androidx.versionedparcelable.VersionedParcelStream$FieldBuffer found in modules versionedparcelable-1.1.1.aar -> versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0.aar -> versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)Duplicate class androidx.versionedparcelable.VersionedParcelable found in modules versionedparcelable-1.1.1.aar -> versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0.aar -> versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)Duplicate class androidx.versionedparcelable.VersionedParcelize found in modules versionedparcelable-1.1.1.aar -> versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0.aar -> versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)

错误分析

  • 这个错误是由于新增的依赖库中包含了Android Support Library 的依赖,跟项目中使用的 AndroidX 发生了类冲突。从 Android 9.0(API 级别 28)开始,Android Support Library 已被废弃,Google 推荐使用 AndroidX 来替代。

解决方法

  • 在项目的 gradle.properties 文件中增加自动迁移配置,此时重新编译,即可编译通过
	android.useAndroidX=trueandroid.enableJetifier=true
  • android.useAndroidX=true:启用 AndroidX。
  • android.enableJetifier=true:启用 Jetifier 工具,自动迁移项目中的第三方库依赖。

四、配置文件权限

1、确保应用有权限读取 PDF 文件,在 AndroidManifest.xml 中添加以下权限:

	<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/><uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>

2、如果文件存储在外部存储中,还需要动态申请权限:

	// 运行时权限private val requestPermissionLauncher = registerForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted ->if (isGranted) {// 权限被授予Toast.makeText(this, "Permission granted", Toast.LENGTH_SHORT).show()} else {// 权限被拒绝Toast.makeText(this, "Permission denied", Toast.LENGTH_SHORT).show()}}/*** 动态申请权限*/private fun requestPermission1() {requestPermissionLauncher.launch(Manifest.permission.READ_EXTERNAL_STORAGE)}

3、手动申请 “所有文件访问权限”

  • 从 Android 10(API 级别 29)开始,引入了分区存储(Scoped Storage),限制了应用对外部存储的访问权限。只有 READ_EXTERNAL_STORAGE 权限,无法打开 PDF 文件,还需要申请 MANAGE_EXTERNAL_STORAGE 权限,并且手动引导用户手动开启 “所有文件访问权限”。
	/*** 申请 所有文件访问权限*/private fun requestManagerPermission() {if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {if (!Environment.isExternalStorageManager()) {val intent = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION)val applicationId = "com.example.helloworld"//BuildConfig.APPLICATION_IDintent.data = "package:$applicationId".toUri()startActivity(intent)}}}

五、PDFView 常用方法

  • fromFile(File file):从文件路径加载 PDF 文件。
	val filePath = "$filesDir/example.pdf"pdfView.fromFile(new File(filePath )).load();
  • fromAsset(String assetName):从 assets 目录(res/main/assets/example.pdf)加载 PDF 文件。
	pdfView.fromAsset("example.pdf").load();
  • fromUri(Uri uri):从 URI 加载 PDF 文件。

  • defaultPage(int page):设置默认显示的页面。

  • enableSwipe(boolean swipe):启用或禁用滑动翻页。

  • enableDoubletap(boolean doubletap):启用或禁用双击放大。

  • zoom(float scale):设置 PDFView 的初始缩放比例。

  • rotate(int degrees):设置 PDFView 的初始旋转角度。

  • onPageChange(OnPageChangeListener listener):设置页面改变时的监听器。

  • onError(OnErrorListener listener):设置错误监听器。

  • enableAnnotationRendering(boolean enabled):启用注释渲染。

  • setOffscreenPageLimit(int limit):设置预加载页数,避免 OOM 问题。

6、代码示例

http://www.dtcms.com/wzjs/475130.html

相关文章:

  • 网络营销策划论文青岛网络优化费用
  • 网站开发要用到的工具盐城seo排名
  • 福田区住房和建设局网站收录网
  • vi毕业设计代做网站职业技能培训网站
  • 做网站技术员北海百度seo
  • 三河网站建设百度地图关键词优化
  • 网站开发公司怎么做账百度的搜索引擎优化
  • 廉洁 网站建设外贸网站推广seo
  • 网站建设服务费如何做会计分录产品推广文案怎么写
  • 做一个宣传网站的策划书搜索引擎整合营销
  • 设计好的制作网站榆林seo
  • wordpress 游戏 模板下载杭州优化公司哪家好
  • 新网站如何推广bing搜索国内版
  • 哪里有个人做网站的游戏推广文案
  • 小白 宝塔 wordpress搜索引擎优化包括
  • 做外贸开店用哪个网站软文写作模板
  • 网站板块设计有哪些有道搜索
  • shopex网站百度小说搜索风云排行榜
  • python 网站开发 普及百度联盟app
  • wordpress 没有添加主题网站百度关键词优化
  • 网站应用市场设计seo流量
  • 公立幼儿园网站建设方案网站查询工具seo
  • 做网站赚什么钱小红书推广引流
  • 如何在云主机上建设网站苏州手机关键词优化
  • 微信做的地方门户网站免费手机网站自助建站
  • 做网站用的文本编辑器seo综合查询网站
  • html中文网站作业十大营销模式
  • B2C网站建设多少钱足球世界排名
  • 网站建设电话销售模版搜索引擎营销方式
  • wordpress调查插件杭州seo推广公司