StickersManager class not found for Quickblox - android

I am trying to use Quickblox's sample chat application.
http://quickblox.com/developers/Android_XMPP_Chat_Sample
But I am getting this error "The import vc908 cannot be resolved"
At this line :
import vc908.stickerfactory.StickersManager;
I have used these libs :
- quickblox-android-sdk-chat-2.2.6.jar
- quickblox-android-sdk-core-2.2.6.jar
Also Added these :
- android-support-v7-appcompat
- google-play-services_lib
- pull-to-refresh

StickersManager is a part of StickerPipe library. To use stickers functionality, you must include dependency to this library
repositories {
maven { url 'http://maven.stickerpipe.com/artifactory/stickerfactory' }
}
dependencies {
compile('vc908.stickers:stickerfactory:0.2.2#aar') {
transitive = true;
}
}
This integration described at Stickers section of documentation
You need use android studio to build project. If you use Eclipse, try to migrate with this tutorial
UPDATE
Eclipse users now can follow this instructions to add StickerPipe library
And another sample with StickerPipe library

Related

How can we know that android project builded from support or androidx library?

As the title of this question, I'm going to import two difference maven library to my library poject,
At the same way,I'm going to provide two types dependencies, the one is android support, and the one is androidx
My Question is:
Is there any flags that let me know androidx or android support used? like bekow code snippet:
if(isUsedAndroidx){
implementation "library of androidx"
} else {
implementation "library of android support"
}
The flag android.useAndroidX is work for this feature? like below:
if (android.useAndroidX !=null && android.useAndroidX.toBoolean()){
print "xxxxxxxxxxxxxxxxxxx used useAndroidX"
} else {
print "xxxxxxxxxxxxxxxxxxx used used android support "
}

Kotlin Native compile jar and framework

I'm building a multiplatform library for Android and iOS. My gradle file looks like this:
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.4.0'
}
repositories {
mavenCentral()
}
group 'com.example'
version '0.0.1'
apply plugin: 'maven-publish'
kotlin {
jvm()
// This is for iPhone simulator
// Switch here to iosArm64 (or iosArm32) to build library for iPhone device
ios {
binaries {
framework()
}
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib-common')
implementation("com.ionspin.kotlin:bignum:0.2.2")
}
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
jvmMain {
dependencies {
implementation("com.ionspin.kotlin:bignum:0.2.2")
}
}
jvmTest {
dependencies {
implementation kotlin('test')
implementation kotlin('test-junit')
}
}
iosMain {
}
iosTest {
}
}
}
configurations {
compileClasspath
}
Im using a third party library and I'm using it like this:
fun test(value: String): Int {
return BigDecimal.parseString(value).toBigInteger().intValue()
}
The problem is when I build the .jar the bignum library isn't included, and when I use the lib in an Android project I get an exception ClassNotFoundException: Didn't find class "com.ionspin.kotlin.bignum.decimal.BigDecimal".
Is there a way to include third party libs in the .jar for Android and .framework for iOS?
JVM
So, the only way I've found to generate a Fat JAR that works like you expect is by adding two custom gradle tasks in project:build.gradle.kts of your KMP library after appling the java plugin.
plugins {
[...]
id("java")
}
[...]
kotlin {
jvm {
[...]
compilations {
val main = getByName("main")
tasks {
register<Copy>("unzip") {
group = "library"
val targetDir = File(buildDir, "3rd-libs")
project.delete(files(targetDir))
main.compileDependencyFiles.forEach {
println(it)
if (it.path.contains("com.")) {
from(zipTree(it))
into(targetDir)
}
}
}
register<Jar>("fatJar") {
group = "library"
manifest {
attributes["Implementation-Title"] = "Fat Jar"
attributes["Implementation-Version"] = archiveVersion
}
archiveBaseName.set("${project.name}-fat")
val thirdLibsDir = File(buildDir, "3rd-libs")
from(main.output.classesDirs, thirdLibsDir)
with(jar.get() as CopySpec)
}
}
tasks.getByName("fatJar").dependsOn("unzip")
}
}
[...]
}
You then must launch the fatJar gradle task that generate a .jar file with the 3rd libraries classes extracted from they corresponding jar archives.
You can customize the two custom gradle scripts even more in order to better fit your needs (here I only included com. package name starting deps).
Then in your Android app app:build.gradle file you can use it as you did or simply
implementation files('libs/KMLibraryTest001-fat-1.0-SNAPSHOT.jar')
iOS
As you ask also for the iOS part in your title (even if it's a second citizen in the main topic of your question) you need only to use api instead of implementation for your 3rd party library along with the export option of the framework.
ios() {
binaries {
framework() {
transitiveExport = true // all libraries
//export(project(":LibA")) // this library project in a trainsitive way
//export("your 3rd party lib") // this 3rd party lib in a transitive way
}
}
}
And you can find a full reference here.
If you see the Krypto library, it has
androidMain
jsMain
jvmMain
mingwX64Main
nativPosixMain
Which means 5 kind of binaries are generated to support 5 platforms
Convincingly, this explains that each platform expects its own binary
for example,
windows -- DLL file
linux -- so file
java -- JAR file
mac -- dylib file
A JAR gets loaded into JVM, but IOS does not use JVM
Separate your Utility functions which has a common logic and write gradle to target multiple platforms
If you want to start with pure multiplatform, you can try this Official Example
Or create a sub gradle module and create a library project which is common to IOS as well as Android
The possible targets are properly documented here
I have created a application which publishes the binary to local repository and re-uses in the MainActivity -- you can get the code here
modify the local.properties for android SDK location and use
gradlew assemble
to build the APK and test it yourself
open the mylib\build.gradle.kts folder and you can see the targets jvm and iosX64 , jvm is used for android
If I'm correct using api instead of implementation should fix your problem, though I didn't try it out yet on the Native part
See Api and implementation separation

How can I import firebase in-app-messaging-display api's source code into my android project?

I am trying to customize the firebase in-app-messaging-display's UI of "Image Only" and "Modal" mode. So I turned to the official documentation, but it is quite simple, by saying:
Creating your own display is a two step process:
1.Write your own implementation of the FirebaseInAppMessagingDisplay class.
2.Register that implemenation with the headless Firebase In-App Messaging SDK.
I wonder how can I import in-app-messaging-display's source code into my project and make it work as a library.
I have downloaded its source code from github:https://github.com/firebase/firebase-android-sdk/tree/master/firebase-inappmessaging-display, tried to import it as a module, but after I selected the Source directory, Android Studio hints that: Specify location of the Gradle
or Android Eclipse project. I also have tried to copy the source code into my project's libs directory and added this: include ':libs:firebase-inappmessaging-display' into my settings.gradle file and this: implementation project(':libs:firebase-inappmessaging-display') into my app's gradle dependency. When sync building Android Studio reports errors like this:
ERROR: Unable to resolve dependency for ':XXXXXXXX': Could not resolve project :libs:firebase-inappmessaging-display.
Any suggestion will be highly appreciated.
The information on the doc is little bit confusing. I am also stuck with the same problem for long time. Actually its very simple.
Add these dependencies in your app level gradle file.
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation ("com.google.firebase:firebase-inappmessaging:17.0.3")
Register Your DisplayMessage component on starting activity.
import com.google.firebase.inappmessaging.FirebaseInAppMessaging
import com.google.firebase.inappmessaging.FirebaseInAppMessagingDisplay
///////
override fun onStart() {
super.onStart()
Log.e("MESSAGE", "activity started")
var firebaseInAppMessagingDisplay = FirebaseInAppMessagingDisplay { inAppMessage, cb ->
// You can show the message here.
// The variable inAppMessage has all information about the campaign that we putting in console (title, content, image url.. etc)
Log.e("MESSAGE", "Display Message callback invoked")
}
FirebaseInAppMessaging.getInstance().setMessageDisplayComponent(firebaseInAppMessagingDisplay)
}

Can't add android library to JCenter

I am trying to publish the library to JCenter with Bintray, according to this article: https://medium.com/#anitaa_1990/6-easy-steps-to-upload-your-android-library-to-bintray-jcenter-59e6030c8890.
I successfully added the library to Bintray, but when I click on "Add to JCenter" button and send compose message - I am getting an error:
Failed to send a message: Package should include sources as part of the package.
Please, tell me what am I doing wrong?
Your Bintray Maven Package doesn't contain the sources, only .aar and the .pom. The in the blog post isn't linked to JCenter, see blog's package here.
Bintray's wiki states that you have to include the sources.
I would use this blog post or this one, where the packages are actually linked to JCenter.
For developers who reach here today, make sure your configuration file has artifact(sourcesJar.get()) in publishing{} like these lines below (not complete build.gradle.kts).
val sourcesJar by tasks.registering(Jar::class) {
classifier = "sources"
from(sourceSets.main.get().allSource)
}
publishing {
publications {
create<MavenPublication>("default") {
from(components["java"])
artifact(dokkaJar)
}
}
publications.invoke {
publicationName(MavenPublication::class) {
artifactId = artifactID
artifact(sourcesJar.get()) // This line
}
}
}

Android: package com.google.api.services.gmail does not exist

As by documentation: https://github.com/google/google-api-java-client
To use Gradle, add the following lines to your build.gradle file:
repositories {
mavenCentral() }
dependencies {
compile 'com.google.api-client:google-api-client:1.18.0-rc' }
Done, but I get:
Error: package com.google.api.services.gmail does not exist
What could be the reason ?
You are adding Google API and trying to use Gmail API. That is why getting Error: package com.google.api.services.gmail does not exist.If you want to use Gmail API add Gmail API Client Library by adding compile 'com.google.apis:google-api-services-gmail:v1-rev29-1.20.0'
Ref: https://developers.google.com/api-client-library/java/apis/gmail/v1
com.google.api-client:google-api-client:1.20.0
on Android Studio->Project Structure->Dependencies-> "+"
you can navigate on repository declared in the gradle and choose the current version available

Categories

Resources