如何解决适用于Android的SendGrid
在将Gradle依赖项添加到我的Android项目之后。因此,当我尝试构建/运行项目时,出现此错误不受支持的类文件主要版本59 在下面,我添加了Gradle文件的应用程序级别和项目级别。我尝试遍历所有内容,但找不到任何相关答案。我在Github SendGrid Issues中也添加了同样的内容,但是没有得到任何回应。
//App-level Gradle I have added this
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsversion "29.0.3"
defaultConfig {
applicationId "com.app.hiforce"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
applicationIdSuffix = '.dev'
debuggable = true
buildConfigField('String','BaseUrl',DevBaseUrl)
manifestPlaceholders = [appLabel: "DEV-HiForce"]
}
release {
minifyEnabled false
buildConfigField('String',ReleaseUrl)
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'
}
}
}
dependencies {
implementation filetree(dir: 'libs',include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
//Networking
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.0.1'
implementation 'com.squareup.okhttp3:okhttp:4.0.1'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.6.0'
implementation 'com.google.firebase:firebase-config:19.2.0'
implementation platform('com.google.firebase:firebase-bom:25.12.0')
implementation 'com.google.firebase:firebase-analytics:17.6.0'
// (Recommended) Add the Google Analytics & Crashlytics dependencies.
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.sendgrid:sendgrid-java:4.6.6'
}
apply plugin: 'com.google.gms.google-services'
// Apply the Crashlytics Gradle plugin
apply plugin: 'com.google.firebase.crashlytics'
//Proj Level gradle i added this
buildscript {
repositories {
google()
jcenter()
// Add Google's Maven repository.
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.4'
classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
解决方法
将Sendgrids Java库集成到android中并不是一件容易的事...
我实际上已经使用Sendgrid的最新API为Android构建了一个Sendgrid库。
https://github.com/Jakebreen/android-sendgrid
实现'uk.co.jakebreen:android-sendgrid:1.0.1'
我维护它,因此,如果您有任何问题,请在github页面上记录问题。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。