I am trying to follow the tutorial here : https://developer.android.com/training/camera/photobasics.html#TaskPath
to make an application using the camera and taking photos. At one point, it is explained that a provider must be provided (ahah) in the manifest to store the picture we took with the camera.
Here is my problem, the provider is not recognize at compilation and my build fail. I learn by searching that apparently, this error means my tag is misplaced. Well... If I move it it Android SMARTLY (yes this is ironic) regenerate it here without asking anything. And obvioulsy fail it's build.
Here is my manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.matthieu.projet"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="21"
android:targetSdkVersion="25" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.example.android.fileprovider"
android:exported="false"
android:grantUriPermissions="true" >
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths" />
</provider>
<meta-data
android:name="android.support.VERSION"
android:value="25.3.1" />
<application
android:allowBackup="true"
android:debuggable="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:testOnly="true"
android:theme="#style/AppTheme" >
<activity android:name="com.example.matthieu.projet.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="com.android.tools.ir.server.InstantRunContentProvider"
android:authorities="com.example.matthieu.projet.com.android.tools.ir.server.InstantRunContentProvider"
android:multiprocess="true" />
</application>
</manifest>
Let me know if you need any more information.
You are editing the wrong manifest file. Ignore the one that pops up in the IDE, as that is one that is generated as part of the build process and displayed erroneously, courtesy of this three-year-old Android Studio bug.
Go back into your module and edit the original manifest.
See this blog post for more.
Related
I was developing an app for google service text detection, and encounter a problem for sharing files using File_PROVIDER.
AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="myPackageFoo">
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.google.android.nearby.messages.API_KEY"
android:value="#string/API_KEY" />
<meta-data
android:name="com.google.android.gms.vision.DEPENDENCIES"
android:value="ocr" />
<activity android:name=".MainActivity" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="myPackageFoo.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/provider_paths" />
</provider>
</application>
For res/xml/provider_paths.xml:
<paths>
<files-path path="images/" name="myimages" />
<external-path name="download" path="download/"/>
</paths>
However I always get this compilation error:
Error:No resource found that matches the given name (at 'resource' with value '#xml/provider_paths').
What went wrong?
I just spent ages on the same issue.
Some people suggested typos (no typos there) some mentioned other possibilities like wrong folder or advising techniques of modifying config.xml or checking sdk versions....
The thing that was missing for me was that the "provider_paths.xml" Build Action was set to Content and not to AndroidResource hence it was never copied during compilation hence it was missing and never found...
I think this is the same issue here.
This question already has answers here:
AAPT2 error: check logs for details: unknown element <action> found
(2 answers)
Closed 5 years ago.
I recently installed Android Studio 3.0 from the Canary channel. However, loading my old projects, this keeps on popping up in the AndroidManifest.xml file that's automatically generated depending on the build variant:
Error:(49) unknown element <uses-sdk> found
This also is displayed:
Error:/home/computername/AndroidStudioProjects/applicationname/app/build/intermediates/manifests/full/release/AndroidManifest.xml:49 unknown element <uses-sdk> found
Needless to say, this wasn't an issue in Android Studio 2.3. Any ideas on how to solve this? I've read a handful of similar issues here but none solved my problem. By the way - it doesn't matter if I set the build variant to debug or release, it says the same thing. Also, the "R" class doesn't work, and if I hover over the manifest xmlns:android="http://schemas.android.com/apk/res/android declaration, it says "URI is not registered".
Again, the project structure hasn't changed at all, I've only upgraded to Android Studio 3.0.
Thanks!
Here's the AndroidManifest.xml file that is under the /src/main folder, which works perfectly fine. The problem is with the generated AndroidManifest.xml files in the /app/build/intermediates/manifests/full folder - THESE are the ones that break my app.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.domain.appname">`
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".view.MainActivity"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".view.TabbedActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar"
android:screenOrientation="landscape"
android:configChanges="keyboardHidden|orientation|screenSize"
android:noHistory="true">
</activity>
</application>
<!-- PROTECTION_NORMAL permissions, automatically granted -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- DANGEROUS PERMISSIONS, must request -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
Here's the way the debug or release auto-generated Manifests that don't work look like:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.domain.appname"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="21"
android:targetSdkVersion="25" />
<!-- PROTECTION_NORMAL permissions, automatically granted -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- DANGEROUS PERMISSIONS, must request -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<meta-data
android:name="android.support.VERSION"
android:value="25.3.1" />
<application
android:allowBackup="true"
android:debuggable="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity
android:name="com.domain.appname.view.MainActivity"
android:noHistory="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.domain.appname.view.TabbedActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="#string/app_name"
android:noHistory="true"
android:screenOrientation="landscape"
android:theme="#style/AppTheme.NoActionBar" >
</activity>
<uses-sdk
android:minSdkVersion="21"
android:targetSdkVersion="25" />
</application>
</manifest>
Later edit
I've went back to Android Studio 2.3, and set the gradle plugin back to 2.3.2, and here's how the automatically generated AndroidManifest.xml looks like now:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.domain.appname.test" >
<uses-sdk
android:minSdkVersion="21"
android:targetSdkVersion="26" />
<instrumentation
android:name="android.support.test.runner.AndroidJUnitRunner"
android:functionalTest="false"
android:handleProfiling="false"
android:label="Tests for com.domain.appname"
android:targetPackage="com.domain.appname" />
<application>
<uses-library android:name="android.test.runner" />
</application>
</manifest>
Now everything works as usual, however, note the difference between the automatically generated Manifest file under gradle 3.0.0 and the one under gradle 2.3.2
I guess I'll have to wait until someone finds a solution to make this work under gradle 3.0.0 and in the meantime use the gradle plugin 2.3.2 in Android Studio 3.0 (which I'm doing right now and it works).
So the issue is with the new gradle 3.0.0-alpha9
You probably have a dependency library (aar) that has a <uses-sdk> inside the application tag in the manifest. So when that gets merged, your app will have the incorrect usage also.
This happened to me with an old local build of vlc for Android.
I had a category element in my Manifest file inside a regular activity which was causing build failure. removing it after updating to as3-rc1 and build tool 26+ my issue was resolved. Hope this helps someone.
<activity
android:name=".AboutUsActivity"
android:label="#string/title_activity_about_us"
android:parentActivityName=".MainActivity"
android:theme="#style/AppTheme.NoActionBar">
<category android:name="android.intent.category.DEFAULT" />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.MainActivity" />
</activity>
if problem remains, please check this official tutorial on migrate to Gragle plugin v. 3.0.0.
Got the same error, in my case there was typo in meta_data instead of meta-data in the Manifest file preventing a build.
<-- I m getting this fatal error which occurred while trying to upload pictures for my app in the android studio.please help get rid of this error.whats the best solution? the error is: Unable to find explicit activity class {}; have you declared this activity in your AndroidManifest.xml -->>
----------
----------
: Unable to find explicit activity class {}; have you declared this
activity in your AndroidManifest.
<?XML version="1.0" encoding="utf-8"?>
<manifest XML ns:android="http://schemas.android.com/apk/res/android"
package="com.parse.starter" >
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="18"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-sdk
android:minSdkVersion="15"
android:maxSdkVersion="23"/>
<application
android:name=".StarterApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.parse.APPLICATION_ID"
android:value="#string/parse_app_id" />
<meta-data
android:name="com.parse.CLIENT_KEY"
android:value="#string/parse_client_key" />
<activity
android:name=".MainActivity"
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>
You have to check a package where MainActivity is placed. It should be com.parse.starter. It seems MainActivity is in other place and you are getting an exception.
This can happen when you say copy and paste an activity instead of adding it via Android Studio. Basically it just means you'll need to add this line to your AndroidManifest.xml:
<activity android:name=".your-activity-class-name"></activity>
I'm developing an Android Wear watch face along with its mobile companion configuration activity.
As a start I followed the documentation (https://developer.android.com/training/wearables/watch-faces/configuration.html#CompanionActivity) and used the available examples from Google (https://developer.android.com/samples/WatchFace/index.html), specifically the FitDistanceService.
If I use the actual code from the example it all works. The small gear icon - used to open the companion (phone) configuration activity - shows up in the Android Wear app on the phone and I can open the companion phone config activity by tapping on it.
But if I rename the package name from the default "com.example.android.wearable.watchface" to anything else (even to com.example.android.wearable.mycompany) the gear icon disappears from the Android Wear app on the phone and it becomes impossible to open the configuration activity.
I tried changing the package name in any possible way. I've tried using the Move, Copy, Rename functionalities in Android Studio (v. 2.2.3). I've tried to manually change the package name and all its occurrencies in all of the project files using Sublime Text, also renaming the related folders and changing any occurrence of the package name in the manifest.xml of wear and mobile apps.
After the renaming (moving, copying etc.) it all works perfectly. Not a warning, nothing. The watch face behaves as expected, but the gear icon simply disappears.
This is the MOBILE manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.wearable.watchface" >
<uses-sdk android:minSdkVersion="18"
android:targetSdkVersion="23" />
<!-- Permissions required by the wearable app -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- Location permission used by FitDistanceWatchFaceService -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- All intent-filters for config actions must include the categories
com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION and
android.intent.category.DEFAULT. -->
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<!-- This activity is needed to allow the user to authorize Google Fit for the Fit Distance
WatchFace (required to view distance). -->
<activity
android:name=".ConfigActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="com.example.android.wearable.watchface.CONFIG_FIT_DISTANCE" />
<category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
And this is the WEARABLE one:
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.example.android.wearable.watchface"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk
android:minSdkVersion="21"
android:targetSdkVersion="23"/>
<uses-feature android:name="android.hardware.type.watch"/>
<!-- Required to act as a custom watch face. -->
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- Required for complications to receive complication data and open the provider chooser. -->
<uses-permission android:name="com.google.android.wearable.permission.RECEIVE_COMPLICATION_DATA"/>
<!-- Location permission used by FitDistanceWatchFaceService -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.BODY_SENSORS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name">
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version"/>
<uses-library
android:name="com.google.android.wearable"
android:required="false"/>
<activity android:name="android.support.wearable.complications.ComplicationHelperActivity"/>
<!--
All intent-filters for config actions must include the categories
com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION
and android.intent.category.DEFAULT.
-->
<service
android:name=".FitDistanceWatchFaceService"
android:label="#string/fit_distance_name"
android:permission="android.permission.BIND_WALLPAPER">
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/watch_face"/>
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="#drawable/preview_distance"/>
<meta-data
android:name="com.google.android.wearable.watchface.preview_circular"
android:resource="#drawable/preview_distance_circular"/>
<meta-data
android:name="com.google.android.wearable.watchface.companionConfigurationAction"
android:value="com.example.android.wearable.watchface.CONFIG_FIT_DISTANCE"/>
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService"/>
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE"/>
</intent-filter>
</service>
<activity
android:name=".FitDistanceWatchFacePermissionActivity"
android:label="#string/title_activity_fitdistance_watch_face_permission">
</activity>
<activity
android:name=".BodysensorsWatchFacePermissionActivity"
android:label="#string/title_activity_bodysensors_watch_face_permission">
</activity>
</application>
</manifest>
They both work perfectly, if you don't try to rename the package from "com.example.android.wearable.watchface" to something else.
Any clues? Of course I could go on with the "com.example.android.wearable.watchface" package name, but it seems implausible that it's not possible to change the package name.
Thank you!
I am using Visual Studio 2015 and have a PCL based project created. All this application does is show a splash screen and then navigate to the next page. I am unable to get this to work on Android. Here is the link for the splash screen
The error I get:
The application could not be started. Ensure that the application has
been installed to the target device and has a launchable activity
(MainLauncher = true).
Additionally, check Build->Configuration Manager to ensure this
project is set to Deploy for this configuration.
I have followed this link and tried all the solutions there and still have the same result
Any tips to fix this?
Edit
Android Manifest File
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="Splash.Splash" android:installLocation="auto" android:versionCode="1" android:versionName="1.0">
<!--suppress UsesMinSdkAttributes-->
<uses-sdk android:minSdkVersion="15" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application android:icon="#drawable/icon-3" android:name="mono.android.app.Application" android:allowBackup="true" android:label="Splash.Splash" android:debuggable="true">
<activity android:label="Splash screen" android:name="md5ac585b47313c1dc414c7b7a18f93e457.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:icon="#drawable/icon-3" android:noHistory="true" android:theme="#style/Theme.Splash" android:name="md5ac585b47313c1dc414c7b7a18f93e457.Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider android:name="mono.MonoRuntimeProvider" android:exported="false" android:initOrder="2147483647" android:authorities="Splash.Splash.mono.MonoRuntimeProvider.__mono_init__" />
<!--suppress ExportedReceiver-->
<receiver android:name="mono.android.Seppuku">
<intent-filter>
<action android:name="mono.android.intent.action.SEPPUKU" />
<category android:name="mono.android.intent.category.SEPPUKU.STM.STM" />
</intent-filter>
</receiver>
</application>
</manifest>
Edit
New Manifest below
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="Super.Super" android:installLocation="auto">
<uses-sdk android:minSdkVersion="15" />
<application android:icon="#drawable/stmicon-3"></application>
</manifest>
EDITED: There was more than one problem in your question. I addressed two of them but the last one was the icon name.
Android resources can't have the '-' character in the name.
so this is the correction:
<application android:icon="#drawable/stmicon3"></application>
Initial answer:
Its wrong to have two activities with the same intent filter for launching.
So, first on your Manifest, remove entirely the two Activities tags.
For helping debugging this. please change your manifest to this (yes we are ignoring the Provider too)
So your final Manifest would be:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.yournamespace.courier">
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application android:label="yournamespace">
</application>
</manifest>
After this, were gonna set the SplashActivity as MainLauncher:
[Activity(MainLauncher = true,
NoHistory = true)]
public class SplashActivity : AppCompatActivity
And finally the MainActivity:
[Activity(Icon = "#drawable/icon")]
public class MainActivity : FormsAppCompatActivity
You Can Do As Jon Sugguested Or Just Go Into Your Android Device Settings & Application Manager And uninstall the previous version of the application on your android device