android中的变量uri找不到,android - 错误找不到符号变量FileProvider包android.support.v4.content不存在 - 堆栈内存溢出...

我正在使用Android Studio 3.5 Gradle插件3.5.0版本5.6.2

我面临着这两个错误

错误:程序包android.support.v4.content不存在

错误:找不到符号变量FileProvider

有任何想法吗?

AndroidManifest.xml

android:name="android.support.v4.content.FileProvider"

android:authorities="com.scanlibrary.provider"

android:exported="false"

android:grantUriPermissions="true">

android:name="android.support.FILE_PROVIDER_PATHS"

android:resource="@xml/provider_paths"/>

build.gradle(模块:应用)

compileSdkVersion 29

buildToolsVersion "29.0.2"

defaultConfig {

applicationId "com.example.capturedocf"

minSdkVersion 19

targetSdkVersion 29

}

dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

testImplementation 'junit:junit:4.12'

androidTestImplementation 'androidx.test:runner:1.2.0'

androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

implementation 'androidx.appcompat:appcompat:1.1.0'

implementation'com.github.chernovdmitriy.injectionholder:appcompat:1.0.0'

implementation project(path: ':scanlibrary')

}

build.gradle(模块:scanlibrary)

apply plugin: 'com.android.library'

android {

compileSdkVersion 29

buildToolsVersion "29.0.2"

defaultConfig {

minSdkVersion 19

targetSdkVersion 19

versionCode 1

versionName "1.0"

ndk

{

moduleName "Scanner"

}

}

sourceSets.main

{

jni.srcDirs = []

jniLibs.srcDir 'src/main/libs'

}

}

dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:support-v4:29.0.2'

}

PickImageFragement.java

import android.support.v4.content.FileProvider;

public class PickImageFragment extends Fragment {

public void openCamera() {

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {

Uri tempFileUri =

FileProvider.getUriForFile(getActivity().getApplicationContext(),

"com.scanlibrary.provider", // As defined in Manifest

file);

cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, tempFileUri);

} else {

Uri tempFileUri = Uri.fromFile(file);

cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, tempFileUri);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值