Open skinner2012 opened 8 years ago
Hi,
SlackWebSocketSessionImpl is a core class of the library so it looks like the library is not packaged in your apk.
There might be an issue in your gradle build file.
Best regards,
Benoit
Thank you for the response.
I want to offer more information here:
top-build gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.google.gms:google-services:1.3.0-beta1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
project gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.19.2'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://jzaccone.github.io/SlidingMenu-aar' }
flatDir {
dirs 'aars'
}
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
applicationId "com.XXXXX"
minSdkVersion 16
targetSdkVersion 22
versionCode xx
versionName "....."
}
buildTypes {
debug {
applicationIdSuffix ".debug"
buildConfigField "boolean", "LOG_DEBUG", "true"
minifyEnabled true
zipAlignEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
minifyEnabled true
zipAlignEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
productFlavors {
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.crashlytics.sdk.android:crashlytics:2.5.3@aar') { transitive = true }
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.mixpanel.android:mixpanel-android:4.8.0'
compile 'com.parse:parse-android:1.13.0'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.journeyapps:zxing-android-embedded:3.0.1@aar'
compile 'com.google.zxing:core:3.2.0'
compile 'it.sephiroth.android.library.horizontallistview:hlistview:1.2.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'org.java-websocket:Java-WebSocket:1.3.0'
compile 'com.jeremyfeinstein.slidingmenu:library:1.3@aar'
compile 'com.pubnub:pubnub-android:3.7.5'
compile project(':intercom-sdk-base')
compile project(':intercom-sdk-gcm')
compile project(':mbackend')
compile 'com.daimajia.swipelayout:library:1.2.0@aar'
compile(name: 'lookback-android-sdk-0.9.4', ext: 'aar')
compile 'com.squareup:otto:1.3.5'
compile 'io.branch.sdk.android:library:1.10.8'
}
I would appreciate if you can mention the issue in my gradle build files.
Hi,
I know gradle but I don't know well how android plugin is working. If for example you disable proguard and have a look at your APK do you find your dependencies?
about the api you shouldn't be forced to have it locally and you can reference it using
compile 'com.ullink.slack:simpleslackapi:0.5.1'
Best regards,
Benoit
Hi @bcorne,
I added compile 'com.ullink.slack:simpleslackapi:0.5.1'
and referred https://github.com/Ullink/simple-slack-api/issues/1 then added:
compile 'org.glassfish.tyrus.bundles:tyrus-standalone-client:1.8.3'
compile 'com.googlecode.json-simple:json-simple:1.1'
compile 'org.slf4j:slf4j-simple:1.7.7'
compile 'org.slf4j:slf4j-api:1.7.7'
My current build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.crashlytics.sdk.android:crashlytics:2.5.3@aar') { transitive = true }
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.mixpanel.android:mixpanel-android:4.8.0'
compile 'com.parse:parse-android:1.13.0'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.journeyapps:zxing-android-embedded:3.0.1@aar'
compile 'com.google.zxing:core:3.2.0'
compile 'it.sephiroth.android.library.horizontallistview:hlistview:1.2.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'org.java-websocket:Java-WebSocket:1.3.0'
compile 'com.jeremyfeinstein.slidingmenu:library:1.3@aar'
compile 'com.pubnub:pubnub-android:3.7.5'
compile project(':intercom-sdk-base')
compile project(':intercom-sdk-gcm')
compile project(':mbackend')
compile 'com.daimajia.swipelayout:library:1.2.0@aar'
compile(name: 'lookback-android-sdk-0.9.4', ext: 'aar')
compile 'com.squareup:otto:1.3.5'
compile 'io.branch.sdk.android:library:1.10.8'
compile('com.ullink.slack:simpleslackapi:0.5.1') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
exclude module: 'guava'
}
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
compile 'org.glassfish.tyrus.bundles:tyrus-standalone-client:1.8.3'
compile 'com.googlecode.json-simple:json-simple:1.1'
compile 'org.slf4j:slf4j-simple:1.7.7'
compile 'org.slf4j:slf4j-api:1.7.7'
}
But it failed to run and generated the errors below:
Error:java.io.IOException: Can't read [/Users/Skinner/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.1.3/d90276fff414f06cb375f2057f6778cd63c6082f/logback-classic-1.1.3.jar(;;;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [logback-classic-1.1.3.jar:org/slf4j/impl/StaticLoggerBinder.class])
However, I am sure I didn't install ch.qos.logback module. Any suggestion? Thanks!
Skinner
@skinner2012 Hello, I'm also trying to make simple-slack-api work on Android and I also encountered problems. Did you manage to solve yours or find a different working solution for Android?
@skinner2012 and @hot-cheese Got it working on Android, @skinner2012 you were on the right track, I have a similar project gradle with proguard and got the same errors, here's what I used:
proguard rules:
...
-dontwarn ch.qos.logback.**
-keep class ch.qos.logback.** {*;}
-dontwarn org.glassfish.**
-keep class org.glassfish.** {*;}
-dontwarn com.google.common.**
-keep class com.google.common.** {*;}
-dontwarn com.ullink.slack.**
-keep class com.ullink.slack.** {*;}
-dontwarn org.apache.http.**
-keep class org.apache.http.** {*;}
...
project gradle:
...
compile('com.ullink.slack:simpleslackapi:0.6.0') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
...
The other dependencies are already included in the simpleslackapi module.
I added simpleslackapi-0.5.1.jar in Android Studio libs/ of my project, and tried to use bot to send message to a specific channel:
My gradle settings is:
But it failed and the error message below:
Anything I did wrong? Thanks.