I am trying to create a telegram bot in form of an android application, the goal is: when i start the application, the bot would be responsive to its users on the internet!
but when I add the telegrambots-3.4-jar-with-dependencies.jar to app dependencies, the build comes up with the following warning and errors:
Information:Gradle tasks [:app:assembleDebug]
Warning:Ignoring InnerClasses attribute for an anonymous inner class
Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\user1\Documents\AndroidPj\appBot\app\libs\telegrambots-3.4-jar-with-dependencies.jar
Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing org/telegram/telegrambots/generics/LongPollingBot.class
Error:com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\user1\Documents\AndroidPj\appBot\app\libs\telegrambots-3.4-jar-with-dependencies.jar
Information:BUILD FAILED in 34s
Information:4 errors
Information:1 warning
Information:See complete output in console
the mentioned jar file, is the telegram Bot API!
this is my build.gradle [module:app]
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "oa.azadi.omidazadibot"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation files('libs/telegrambots-3.4-jar-with-dependencies.jar')
}