I'm trying an application just show Here map on screen. I've followed all of steps in document of Here + provided app_id, app_code, license key + provided 6 permissions in AndroidManifest.xml.
But It got the following issue:
"ERROR: Cannot initialize Map Fragment: MISSING_PERMISSION"
I'm using gradle 2.8, targetSdkVersion 23, compileSdkVersion 23
Android 6 / API 23 has a new permission system, that means you have to request critical permissions from the user.
See Android docs: https://developer.android.com/training/permissions/requesting.html
Just adding the critical permissions to the manifest is not enough anymore.
If you don't want to do this, you can still set traget API level to 22 and work in legacy mode, but to be more future proof, you should implement the new Android6 way of requesting permissions.
The critical permissions in the HERE SDK that you have to request are:
ACCESS_FINE_LOCATION and WRITE_EXTERNAL_STORAGE
Make sure you are using android runtime permission on for location access as from marshmallow onward all the OS need permission to run
Related
[enter image description here][1]My React Native Android application works perfectly fine on POCO X2 , if I install it via USB. But if I assemble the .apk or .aab ,the app get installed but do not perform action like Login or register.
Please note , this issue is specific for POCO X2 phone. It is working on other phones.
Phone model POCO-X2 , Android 10 , API 29.
I am attaching my build.gradle config:
List item
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 29
}
[1]: https://i.stack.imgur.com/Yl1sM.jpg
Well, I figured it out. I tried to install same application bundle on other android 10 devices and it wasn't working on any.
That means something was blocking the http request made by the application and the actual issue was that latest RN versions target recent Android SDK that blocks insecure HTTP connections automatically.
Just by adding this : android:usesCleartextTraffic="true" inside manifest file inside tag , my problem was solved.Attached the link here
Another solution for this problem is to avoid making http request as they are insecure, and use https instead.
<application ... android:usesCleartextTraffic="true"
I'm trying to comply with the Google requirements to request the permission ACTIVITY_RECOGNITION, for Android 10, but I don't seem to understand why there's no permission popup showing , like with the other permissions (ie, Location, storage,...)
The code I have is:
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACTIVITY_RECOGNITION) != PackageManager.PERMISSION_GRANTED) {
Log.d("TAG", "PERMISSION 'ACTIVITY_RECOGNITION' NOT GRANTED");
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.ACTIVITY_RECOGNITION},
MY_PERMISSIONS_ACTIVITY_RECOGNITION);
} else
{
Log.d("TAG", "PERMISSION 'ACTIVITY_RECOGNITION' GRANTED");
}
And I'm always ending up on the 'NOT GRANTED' flow, but the ActivityCompat.requestPermissions is not showing no popup!
Is there anything else I'm Missing ?
The manifest contains the
and the app.gradle
minSdkVersion 29
targetSdkVersion 30
Running out of ideas, any help would be welcome.
Just to add, I'm running this on my Pixel 2, with the latest firmware available 10.0.0 (QP1A.191105.004, Nov 2019)
check : Privacy changes in Android 10
From API 29(Android Q, Android 10)
Android App need permission in AndroidManifest.xml
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION"/>
Before API 29 AndroidManifest.xml
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
check : Google Fit APIs
And
If the system-auto grants the android.permission.ACTIVITY_RECOGNITION permission, your app retains the permission after you update your app to target Android 10. However, the user can revoke this permission at any time in system settings.
Thanks.
I'm not sure i fully understand this. So, for the <= 21 API version we can just use AndroidManifest.xml to request permissions, but Lollipop and higher APIs we have Requesting permission on runtime feature. So i'm using it with this simpe code:
if (Build.VERSION.SDK_INT >= 23) {
mPermissionsToBeAsked.clear();
for (String permission : AudioRecordingThread.PERMISSIONS_NEEDED) {
if (checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) {
mPermissionsToBeAsked.add(permission);
}
} ....
Then, if that list is not empty i'm requesting them :
if (mPermissionsToBeAsked.size() > 0) {
requestPermissions(mPermissionsToBeAsked.toArray(new String[0]), AUDIO_PERMISSIONS_REQUEST_CODE);
}
But, for some reason, on devices, for example, like Samsung Galaxy S7 with Android 6.0.1, all the permissions grandted by default when app is installed. So i want to know why, BUT, it's there is an even bigger concerne, when i go to my application in Application Manager and manually removing Microphone permision, in the app checkSelfPermission(permission) is still returning GRANTED. So the questions:
Why on devices with API level Lollipop and higher all permissions are still granted by default and above code won't add anything into mPersmissionToBeAsked?
Why if i manually removing permission with title MICROPHONE in Application manager checkSelfPermission(android.permission.RECORD_AUDIO) still returns GRANTED?
Just Cross verify in your app gradle file the targetsdk version is greater than 22.
defaultConfig {
// -----
targetSdkVersion 23
//----
}
If it is less than 23 than permission will automatically been granted to your app.
First of all it's Android M and above that handles permission granting. And that means you should have
targetSdkVersion 23
or above. Otherwise the system considers that the developper did not target this version, meaning that the developper does not check for permissions.
I was trying to implement the MultiImagePicker from Yazeed44 (https://github.com/yazeed44/MultiImagePicker).
The problem I have is, when I open the image selector:
new Picker.Builder(getActivity(), new MyPickListener(), R.style.MIP_theme)
.build()
.startActivity();
The view remains empty where it should be displaying the photo albums to select from. See the screenshot:
What am I missing in order to get this to work?
I'm testing with a Google Nexus 6P with Android 6.0.1. minSdkVersion 19, targetSdkVersion 23. And I'm Gradle importing: net.yazeed44.imagepicker:imagepicker:1.3.0
Try to set targetSdkVersion to 22, the problem occurs because in android 6 you need to request for permissions at run-time. If you have configured targetSdkVersion to 23 in your project, your app needs to support Runtime Permission, but if you doesn't have your code prepared to manage this, you neeed to change targetSdkVersion to 22, in this way you are going to get de old permission behavior.
"Warning: Right now when you create a new project in Android Studio.
targetSdkVersion will be automatically set to the latest version, 23.
If you are not ready to make your application fully support the
Runtime Permission, I suggest you to step down the targetSdkVersion to
22 first."
https://inthecheesefactory.com/blog/things-you-need-to-know-about-android-m-permission-developer-edition/en
Since update AS 1.1 Preview 2, I'm getting red lines under all my Log messages
Log.d(TAG, "message");
With message: "The logging tag can be at most 23 characters..".
I didn't update anything fundamentally, except Android Studio itself. Is this a bug?
You can disable it if you so choose.
In Android Studio, Analyze->Inspect Code.
Under Inspection Profile, click on the button with the 3 horizontal dots.
The following window should open. Search for "log" and uncheck "Too Long Log Tags".
Update: Android Studio 2.2, it is located under Android Lint: Correctness
No, it's not a bug.
From Android Studio's Recent Changes on 1.1 Preview 2,
Checks that the tag passed to the logging calls, if its value can be resolved, is at most 23 characters long (as required by the Logging API.)
As shortly explained on the recent changes, it's due to how Log API doesn't allow tag that exceeds 23 characters.
SLF4J Android has an explanation to this:
[...] the length of such tags is currently limited to 23 characters (23 = 32 - 8 for namespace prefix - 1 for C terminator)
which matches the Android's source code.
Currently, the only function that explicitly mentions this exception is Log.isLoggable(),
...
Throws
IllegalArgumentException is thrown if the tag.length() > 23.
However, based on the comments, apparently the logger does throw the exception on release mode (it's ignored in debug mode).
You can disable the lint checking by following Terence's answer, but you've been warned.
Complementing the answer by #Terence
You can also turn off the specific check via gradle with this in your build.gradle file:
lintOptions {
disable 'LongLogTag'
}
Or by adding a lint.xml file to your project with xml:
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="LongLogTag" severity="ignore" />
</lint>
You can never ignore this lint check, it definitely could bring unexpected results on your release version since it throws exceptions and stops executing (it would not crash your app).
I have had a terrible lesson learned recently: it's OK on debug mode, but behave differently on release version.
This is recent change and In this build, its a new lint check. Which says,
Checks that the tag passed to the logging calls, if its value can be resolved, is at most 23 characters long (as required by the Logging API.)
For more info, read 3rd point in below link.
https://sites.google.com/a/android.com/tools/recent/androidstudio11preview2
If you dont want to get this, minimize the number of characters in your TAG and make sure that they wont cross the length more than 23.
To explain why this happens:
According to AOSP source code you can log with any tag you want. The problem is in Log.isLoggable.
Log.isLoggable checks the system property log.tag.<YOUR_TAG> if the priority you want to log is enabled. Here's documentation of this mechanism:
public static boolean isLoggable (String tag, int level)
Checks to see whether or not a log for the specified tag is loggable at the specified level. The default level of any tag is set to INFO. This means that any level above and including INFO will be logged. Before you make any calls to a logging method you should check to see if your tag should be logged. You can change the default level by setting a system property: 'setprop log.tag. ' Where level is either VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT, or SUPPRESS. SUPPRESS will turn off all logging for your tag. You can also create a local.prop file that with the following in it: 'log.tag.=' and place that in /data/local.prop.
Source: https://developer.android.com/reference/android/util/Log#isLoggable(java.lang.String,%20int)
Below API 26 (Oreo) the limit of system property keys was 31 characters. And "log.tag.".length() + 23 equals 31. If you call Log.isLoggable below Android Oreo with a tag longer than 23 characters it will throw, as described in the source code. Since Android O this limit no longer applies.
The Lint rule exists just to shield you from all these (typically) unnecessary details.
The documentation for Log.isLoggable also states the IllegalArgumentException will not be thrown since API 24, which according to my findings, is wrong. Follow: https://issuetracker.google.com/issues/124593220
Solution. Year 2020 ver.
build.gradle (app)
android {
lintOptions {
disable 'LongLogTag'
} // put this.
}
This error was thrown for me for a node_module library, complaining about a separate node_mode library.
I added this lint options property within that node_module library's build gradle file.
android {
lintOptions {
abortOnError false
}
}
The library was aws-amplify push notification.
Error:
Execution failed for task ':#aws-amplify/pushnotification:lint'
File updated: node_modules/#aws-amplify/pushnotification/android/build.gradle