Android Azure notification hub SDK is not working in Android Pie.
Below are the SDK details:
mavel url: "http://dl.bintray.com/microsoftazuremobile/SDK"
dependencies:
compile 'com.microsoft.azure:notification-hubs-android-sdk:0.4#aar'
compile 'com.microsoft.azure:azure-notifications-handler:1.0.1#aar'
Steps to reproduce:
Receive GCM/FCM token
Create instance of NotificationHub
Call method "registerTemplate" using the instance of NotificationHub along with the required parameters.
Error:
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/net/http/AndroidHttpClient;
at com.microsoft.windowsazure.messaging.Connection.executeRequest(Connection.java:217)
at com.microsoft.windowsazure.messaging.Connection.executeRequest(Connection.java:178)
at com.microsoft.windowsazure.messaging.Connection.executeRequest(Connection.java:134)
at com.microsoft.windowsazure.messaging.NotificationHub.refreshRegistrationInformation(NotificationHub.java:296)
at com.microsoft.windowsazure.messaging.NotificationHub.registerInternal(NotificationHub.java:390)
at com.microsoft.windowsazure.messaging.NotificationHub.registerTemplate(NotificationHub.java:196)
Update your Android Support Library to the latest version will fix the problem. Along with that, a clean and rebuild of the project and a restart of Android Studio could also help.
Currently in Android Pie the reference for httpclient has removed completly from system ClassLoader. Above issue can be fixed if we add the httpclient as a part of application ClassLoader. I have added
<uses-library android:name="org.apache.http.legacy" android:required="false" />
inside application tag of manifest file, it's working now.
For more information please refer below link:
https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p
This has been fixed in the 0.5 version of Azure Notification Hub Android SDK.
Update your Azure dependency to:
implementation 'com.microsoft.azure:notification-hubs-android-sdk:0.5#aar'
This version uses HttpUrlConnection instead of the legacy HttpClient. See pull request: https://github.com/Azure/azure-notificationhubs/pull/48
Related
I am new to maptiler mapbox development , I download app from maptiler. now I am trying to build that app in to my android studio. but there are some errors. I am following it's ReadMe file . I put dependency MapboxGLAndroidSDK.aar in to lib and also apply mapbox public token and secret token at appropriate place as per ReadMe steps . but still I can't run app due to following error:
NoSuchMethodError: No virtual Method setSkuId(Ljava/lang/string;)V in class Lcom/mapbox/android/telemetry/AppUserTurnstile; or its super class
these are my mapbox dependencies:
com.mapbox.mapboxsdk:mapbox-core:4.3.0
com.mapbox.mapboxsdk:mapbox-services:4.3.0
com.mapbox.mapboxsdk:mapbox-geojson:4.3.0
com.mapbox.mapboxsdk:mapbox-android-telemetry:4.3.0
com.mapbox.mapboxsdk:mapbox-android-gestures:0.4.0
these all are prebuild dependencies now I am working with offline mode so if I have to apply more dependency I have to Downoload jar/aar for it. please suggest me some way to solve these error and successful run .Thanks
finally I found a way to run my project.
the conclusion is Mapbox updated it all library and split some. So I have to download all (.aar)Libraries from Maven repository and add it to my projects as library dependency to resolve issue regarding Mapbox library.
recently I updated following library with latest version .aar file:
mapbox-android-sdk
mapbox-sdk-services
mapbox-sdk-turf
mapbox-android-telemetry
mapbox-sdk-geojson
mapbox-android-core
mapbox-android-gestures
If you have internet connectivity you can directly upgrade all the library.
otherwise you can download from this link
I use google map in project, but it is dont work rightly. I have registred Google map Api Key in google services and add in my project AndroidManifest.xml
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value=" Api key" />
But it is don't show map you can see it in this picture:
When i run my app, in tab Anroid Monitor of Android Studio i have this error:
I can't find resolve.
and in Api monitor i have this error too, when i open app
java.io.IOException: Server returned: 3
Did you added play-services dependency in gradle file?
If Possible change your play-service dependency and set dependency based on building tools installed or api installed, like following way
From
compile 'com.google.android.gms:play-services-maps:10.0.1'
To
compile 'com.google.android.gms:play-services-maps:10.2.1'
When following the instructions to migrate an existing app 'that extend a WakefulBroadcastReceiver', I get an error cannot resolve gcm for com.google.android.gms.gcm.GcmReceiver.
Google omitted the instructions to make sure that, if you are compiling individual play-services packages (as recommended), you need to add
compile 'com.google.android.gms:play-services-gcm:7.x.x' to your build.gradle
I am using loginActivity in android.
ERROR
can not find symbol class Builder
I have also imported the file: com.google.android.gms.plus.PlusClient
Error on this line
mPlusClient = new PlusClient.Builder(this, this, this).setScopes(Scopes.PLUS_LOGIN, Scopes.PLUS_ME).build();
This is auto generated file from template.
What could be the reason for this error?
EDIT
I am using android studio
minSdkVersion 11
targetSdkVersion 21
I solved in my project by downgrading play-services to:
compile 'com.google.android.gms:play-services:6.1.71'
in dependencies in gradle file.
It is not available because it is deprecated. Use GoogleApiClient instead.
Start integrating Google+ : This is the official documentation for implementing Google+ client in your Android app for login and other requirements. Please follow this and not the auto-generated code from Android studio (until the code gets updated with newer implementation).
P.S. The other answer suggests to use older version of PlusClient, which is a wrong approach. You should be using newer code Instead of using older play services.
I'm new to Android Studio and i want to implement Urban Airship in one of my projects. I followed the example on their website with the .aar file and I ended up getting this error.
Error: [/Users/AndroidstudioProjects/MyApplication/app/build/intermediates/exploded-aar/com.urbanairship/urbanairship-lib/5.1.0/AndroidManifest.xml:8]
Invalid instruction 'overrideLibrary', valid instructions are : REMOVE,REPLACE,STRICT
Correct me if I'm wrong but doesn't this mean that they have issues in their manifest file? Or am I completely out in the blue? If so, do anyone have a good example on how to implement it?
The Urban Airship SDK builds against Google Play Services that requires Android API 9, while Urban Airship is compatible with 6+. That is why we need the override library version. What android gradle plugin version are you using? You need to use 13.3 or greater. See http://tools.android.com/tech-docs/new-build-system.
In the projects build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.+'
}
}
I just had the same problem, and was able to fix it and build my project:
The offending line is line 8 of the AndroidManifest.xml
I just removed this line and changed some SDK versions.
You can open the file urbanairship-lib-5.1.0.aar using WinRar.
Navigate to the Manifest. Open it and edit within your favourite text editor.
Save and close the manifest. WinRar asks if you want to update the archive. Choose Yes!
According to this page, overrideLibrary is used for when you have minSDK version in a library > minSDK version in your project. So it allows a different version to be compiled instead, without errors.
http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger#TOC-tools:overrideLibrary-marker
Remove, replace etc do something a bit different (also described on that page - scroll up).
Then in my projects build.gradle file I changed the version numbers to match my project:
From this
compile 'com.android.support:support-v4:21.+'
To this
compile 'com.android.support:support-v4:19.+'
Would be good to know what's the outcome of the OP's support ticket. Please keep us posted!
I ran into this issue as well evaluating the 5.1.0 version of the Urban Airship SDK. I am using Android Studio Beta 0.8.14. I contacted Urban Airship support and they told me to increment the version of gradle to 0.13.3. Android Studio 0.8.14 is defaulting to 0.13.2. After changing the version of gradle to 0.13.3 in the project build.gradle file I was able to successfully compile and import the new SDK.