Unresolved Class: FileProvider -- Using Downloaded JAR - android

I've downloaded support-v4-24.1.1.jar and am trying to use FileProvider, however, android:name inside of the manifest is not detecting it. This is all within an Android Module so I can use it inside of Unity.
I looked inside the jar and Android >> Support >> V4 >> Content >> FileProvider.class exists. So I don't know why I'm getting an unresolved class error.
Any help would be greatly appreciated
Android Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.fileproviderplugin">
<application>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="gov.navair.aurora.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="#xml/filepaths" />
</provider>
</application>
Build.Gradle (module level)
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation files('libs/support-v4-24.1.1.jar')
}
}

That library is a few years old and probably should no longer be used. And implementation is the wrong directive to use for code that you are exporting from a module.
Try this instead:
api "com.android.support:support-compat:28.0.0"

Related

Android Cause: duplicate entry: AndroidManifest.xml

My question is already asked by someone. But could not find the solution in that.Same error and same project like in these two links
enter link description here
enter link description here
None of above links questions not answered properly.For me, It was working first. I migrated to androidx then got this error. Can someone help me to solve issue and how duplicated file created ?
Manifest 1 :
Already added in those two links.
Manifest 2 : Another module Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rahuljanagouda.statusstories">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:label=
"#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
>
<meta-data
android:name="com.rahuljanagouda.statusstories.glideProgressBar.OkHttpProgressGlideModule"
android:value="GlideModule" />
<activity android:exported="true"
android:name="com.rahuljanagouda.statusstories.StatusStoriesActivity" />
</application>
</manifest>
Build.gradle :
apply plugin: 'com.android.library'
//apply plugin: 'com.github.dcendents.android-maven'
group = 'com.github.rahuljanagouda'
version = '1.0.0'
android {
compileSdkVersion 29
buildToolsVersion '29.0.3'
defaultConfig {
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
// Glide v3 (stable)
implementation 'com.github.bumptech.glide:glide:3.9.0-SNAPSHOT'
// OkHttp3
implementation 'com.github.bumptech.glide:okhttp3-integration:1.6.0-SNAPSHOT'
implementation 'com.squareup.okhttp3:okhttp:3.14.4'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
}
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
}
Try to update all the libraries to latest version and also check your lib folder for the project. Delete the files from that folder if exist any .

Attribute providers FirebaseInitProvider and FacebookInitProvider from AndroidManifest also present at AndroidManifest

My application was composed of only one application module. I recently tried to split it into 2 modules (a feature base and a application apk one) in order to add later an instant-app module.
My newly created feature module's AndroidManifest and gradle.build contain everything that was inside the previous application module ones:
feature AndroidManifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest package="base.package"
xmlns:android="http://schemas.android.com/apk/res/android">
<!-- all uses-permissions and permissions -->
<application>
<!-- activities, intent-filters... -->
<provider android:authorities="com.facebook.app.FacebookContentProvider663###########"
android:name="com.facebook.FacebookContentProvider"
android:exported="true"/>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/provider_paths"/>
</provider>
<!-- etc -->
</application>
</manifest>
application AndroidManifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest package="app.package"
xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
feature build.gradle :
apply plugin: 'com.android.feature'
android {
buildTypes {
debug {
// debug values
}
release {
// release values
}
}
lintOptions {
checkReleaseBuilds false
}
compileSdkVersion rootProject.compileSdk
defaultConfig {
minSdkVersion rootProject.minSdk
targetSdkVersion rootProject.compileSdk
versionCode rootProject.versionCode
versionName rootProject.versionName
}
baseFeature true
}
dependencies {
api "com.android.support:appcompat-v7:$rootProject.supportLib"
application project(':apk')
compile "com.google.firebase:firebase-core:$rootProject.gmsLib"
compile 'com.facebook.android:facebook-android-sdk:4.27.0'
// other dependencies
}
application build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.compileSdk
defaultConfig {
applicationId "app.package"
minSdkVersion rootProject.minSdk
targetSdkVersion rootProject.compileSdk
versionCode rootProject.versionCode
versionName rootProject.versionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation project(":feature")
}
apply plugin: 'com.google.gms.google-services'
However, although everything builds fine, I have a problem with my APK run configuration:
When I select Default Activity in Launch Options, I get a Default Activity not found warning , and when I select a specific one, I get a The Activity 'XXXX' is not declared in AndroidManifest.xml one.
After some research, I realized this is because of an error with the apk Manifest, that I was able to find by looking at the "Merged Manifest" option. Here is the output:
I couldn't find relevant information to help me about this issue... thanks for any help!
I was able to solve this issue by adding tools:node="replace" in the <application> node of the feature's AndroidManifest. Also, don't forget to add xmlns:tools="http://schemas.android.com/tools" at Manifest top-level.
Try to add these providers in your base module and feature module to fix merge manifest error.
<provider
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:authorities="{$applicationId}.firebaseinitprovider"
android:exported="(check library provider have exported value true or false)"
tools:node="replace"/>
<provider
android:name="com.facebook.internal.FacebookInitProvider"
android:authorities="{$applicationId}.FacebookInitProvider"
android:exported="(check library provider have exported value true or false)"
tools:node="replace"/>

how to integrate OpenCameraApp in my project as a module

I have integrated This project as a module in my applictaion. When I am integrating, getting error as mentioned below. I have got so many links on SO suggesting me to downgrade studio version, or upgrade etc. Followed this for adding module in my project.
com.android.ide.common.process.ProcessException: Error while executing
'E:\Softwares\sdk1\build-tools\25.0.3\llvm-rs-cc.exe' with arguments {-O 3 -
I E:\Softwares\sdk1\build-tools\25.0.3\renderscript\include\ -I
E:\Softwares\sdk1\build-tools\25.0.3\renderscript\clang-include\ -p D:\SVN-
WORKS\MyApplication\openCamera\build\generated\source\rs\release -o D:\SVN-
WORKS\MyApplication\openCamera\build\generated\res\rs\release\raw -target-
api 15 D:\SVN-WORKS\MyApplication\openCamera\src\main\rs\align_mtb.rs
D:\SVN-WORKS\MyApplication\openCamera\src\main\rs\create_mtb.rs D:\SVN-
WORKS\MyApplication\openCamera\src\main\rs\histogram_adjust.rs D:\SVN-
WORKS\MyApplication\openCamera\src\main\rs\histogram_compute.rs D:\SVN-
WORKS\MyApplication\openCamera\src\main\rs\process_hdr.rs}
Here is the answer for the possible difficulties which you will face while adding a project as module/library in another application.
follow this video tutorial for adding a project as module/library.
Below are some points which you need to consider.
Change very first line of your build.gradle(library) from "apply plugin: 'com.android.application' " to "apply plugin: 'com.android.library' "
Remove applicationId from build.gradle(library)
Make sure build.gradle(app) and build.gradle(library) should be exactly same.
like below
build.gradle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.xyz.xyzxyz"
minSdkVersion 7
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile project(':openCamera')
compile fileTree(dir: 'libs', include: ['*.jar'])
}
build.gradle(library)
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 7
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.mcxiaoke.volley:library:1.0.18'
compile 'com.android.support:appcompat-v7:22.0.0'
}
If both your application as well as your library module has the MainActivity and activity_main.xml file, then make changes either in app or library. Because you may get rumTime error like binary xml error at #40(lineNumber) etc.
Your android studio version and project level gradle dependency should have same verion. Like if your studio version is 2.3.1 then dependeny block should have " classpath 'com.android.tools.build:gradle:2.3.1' "
Last but not least,delete tag of your library's mainActivity from library's manifest file. code looks like below. If you don't delete or comment it then two launchers will be there in your project and it will create two icons.
<!-- Comment or delete tag to avoid two launchers in your application -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>

INSTALL_FAILED_OLDER_SDK on Android Studio because of Android L [duplicate]

I'm new to Android and I'm using the Android Studio. I've created a new project just to show the Hello World! but I can't get it working on the AVD because of this error: Failure [INSTALL_FAILED_OLDER_SDK].
I already searched for the answer and I know it's something about the build.gradle and the minSdkVersion but any of the answers worked for me.
This is my AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.scoelli.test" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MyActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
And this is my build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-L'
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.scoelli.test"
minSdkVersion 8
targetSdkVersion 'L'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
I would appreciate not only the answer but the explanation.
Thank You!
Unless you know you want to be using the Android L developer preview with your application, do not target and compile with it. It is still very much a preview release, and it appears as though applications targeting and compiling for the preview cause this error with any non-L device.
Update these lines in your build.gradle to stick with the latest stable release (Android 4.4, API 19):
android {
compileSdkVersion 19
defaultConfig {
targetSdkVersion 19
}
}
I fixed this problem.
I just modified the compileSdkVersion from android_L to 19
to target my nexus 4.4.4.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
}
android {
**compileSdkVersion 'android-L'** modified to 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.antwei.uiframework.ui"
minSdkVersion 14
targetSdkVersion 'L'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
**compile 'com.android.support:support-v4:21.+'** modified to compile 'com.android.support:support-v4:20.0.0'
}
how to modified the value by ide.
select file->Project Structure -> Facets -> android-gradle and then modified the compile Sdk Version from android_L to 19
sorry I don't have enough reputation to add pictures
I think projects with
compileSdkVersion 'android-L'
cannot be installed in other Android versions right now.
I might be wrong there but if you're not doing anything specific to the L preview SDK, just set the compile version to one of the official ones.
Same goes for the targetSdk.
You can choose those in the Create Project wizard.
If you get this error when compiling Adobe AIR mobile app - just correct "minSdkVersion" this line in the application descriptor xml file:
<uses-sdk android:minSdkVersion="13" android:targetSdkVersion="15"></uses-sdk>

Failure [INSTALL_FAILED_OLDER_SDK] Android Studio

I'm new to Android and I'm using the Android Studio. I've created a new project just to show the Hello World! but I can't get it working on the AVD because of this error: Failure [INSTALL_FAILED_OLDER_SDK].
I already searched for the answer and I know it's something about the build.gradle and the minSdkVersion but any of the answers worked for me.
This is my AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.scoelli.test" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MyActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
And this is my build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-L'
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.scoelli.test"
minSdkVersion 8
targetSdkVersion 'L'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
I would appreciate not only the answer but the explanation.
Thank You!
Unless you know you want to be using the Android L developer preview with your application, do not target and compile with it. It is still very much a preview release, and it appears as though applications targeting and compiling for the preview cause this error with any non-L device.
Update these lines in your build.gradle to stick with the latest stable release (Android 4.4, API 19):
android {
compileSdkVersion 19
defaultConfig {
targetSdkVersion 19
}
}
I fixed this problem.
I just modified the compileSdkVersion from android_L to 19
to target my nexus 4.4.4.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
}
android {
**compileSdkVersion 'android-L'** modified to 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.antwei.uiframework.ui"
minSdkVersion 14
targetSdkVersion 'L'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
**compile 'com.android.support:support-v4:21.+'** modified to compile 'com.android.support:support-v4:20.0.0'
}
how to modified the value by ide.
select file->Project Structure -> Facets -> android-gradle and then modified the compile Sdk Version from android_L to 19
sorry I don't have enough reputation to add pictures
I think projects with
compileSdkVersion 'android-L'
cannot be installed in other Android versions right now.
I might be wrong there but if you're not doing anything specific to the L preview SDK, just set the compile version to one of the official ones.
Same goes for the targetSdk.
You can choose those in the Create Project wizard.
If you get this error when compiling Adobe AIR mobile app - just correct "minSdkVersion" this line in the application descriptor xml file:
<uses-sdk android:minSdkVersion="13" android:targetSdkVersion="15"></uses-sdk>

Categories

Resources