'Android Studio stuck installing application to Device after add jar library
I'm setting up a SignalR client with Android. I'm using Android Studio 3.3 with Gradle v3.0.1.
I'm using two SignalR deprecated jar library in project. - signalr-client-sdk.jar - signalr-client-sdk-android.jar
The problem starts after adding these two jar dependencies to project. After adding jar libs, Android Studio suck in installing application on device.
I did same thing in other project on my friend's PC and it works. I don't know whats wrong with this?
=====
UPDATE
I tried with an other device... I installed GenyMotion Emulator and Created several kind of Virtual Machines. Android Studio is going to install the application on vm with api level 16 but when trying to install on vm with api level 27(8.1) it stuck again.
- I could generate signed apk and install on phone. but can't install directly from Android studio.
Solution 1:[1]
UPDATE
Add these lines to your build.gradle of app module, within the android { }:
android {
splits {
abi {
enable true
reset()
include 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'mips', 'mips64', 'arm64-v8a'
universalApk true
}
}
packagingOptions {
exclude 'lib/getLibs.ps1'
exclude 'lib/getLibs.sh'
exclude 'lib/gson-2.2.2.jar'
}
}
Old Answer
Try these steps:
Step One: Add this dependency to your build.gradle:
implementation 'com.microsoft.signalr:signalr:1.0.0'
Step Two: Add these lines to your activity:
private final String serverUrl = "put your server url";
private HubConnection hubConnection;
hubConnection = HubConnectionBuilder.create(serverUrl).build();
if (hubConnection.getConnectionState() == HubConnectionState.DISCONNECTED)
hubConnection.start();
if (hubConnection.getConnectionState() == HubConnectionState.CONNECTED)
hubConnection.send("your method name at server", your arguments);
else if (hubConnection.getConnectionState() == HubConnectionState.DISCONNECTED)
hubConnection.start();
As you see at above, you don't need to add two signalR deprecated jar library in project.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ryan Dooley |