简体   繁体   English

适用于 Android 的 SendGrid

[英]SendGrid for Android

After adding Gradle dependencies to my Android Project.将 Gradle 依赖项添加到我的 Android 项目后。 So when I try to build/run my project I get this error Unsupported class file major version 59 Below I have added both the Gradle files App-level as well as the Project level.因此,当我尝试构建/运行我的项目时,我收到此错误Unsupported class file major version 59下面我添加了 Gradle 文件应用程序级别和项目级别。 I tried searching all the over but couldn't find any related answer.我试着搜索了一遍,但找不到任何相关的答案。 I have also put the same in Github SendGrid Issues but didn't got any response yet.我也在 Github SendGrid 问题中放了同样的内容,但还没有得到任何回应。

//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', 'BaseUrl', 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
}

Integrating Sendgrids java library into android isn't straight forward...将 Sendgrids java 库集成到 android 中并不是一件容易的事......

I've actually built a Sendgrid library for Android using Sendgrid's latest API.我实际上已经使用 Sendgrid 的最新 API 为 Android 构建了一个 Sendgrid 库。

https://github.com/Jakebreen/android-sendgrid https://github.com/Jakebreen/android-sendgrid

implementation 'uk.co.jakebreen:android-sendgrid:1.2.3'实现 'uk.co.jakebreen:android-sendgrid:1.2.3'

I maintain it so if you have any questions log an issue on the github page.我维护它,所以如果您有任何问题,请在 github 页面上记录问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM