Android studio:结合leanCloud实现登陆注册功能

首先,注册leanCloud账号,创建自己的应用并获取SDK

1、打开根目录下的build.gradle进行如下配置

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    
    repositories {
        google()
        jcenter()
        maven {
            url "http://mvn.leancloud.cn/nexus/content/repositories/public"//仓库地址
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "http://mvn.leancloud.cn/nexus/content/repositories/public"//仓库地址
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

2、然后打开APP目录下的build.gradle进行如下配置:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.zs.login"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
    lintOptions {
        abortOnError false
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.android.support:design:27.1.1'
    testImplementation 'junit:junit:4.12'

    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'cn.leancloud.android:avoscloud-sdk:v4.6.4'
    implementation 'cn.leancloud.android:avoscloud-statistics:v4.6.4'
    implementation 'cn.leancloud.android:avoscloud-feedback:v4.6.4@aar'
    implementation 'cn.leancloud.android:avoscloud-sns:v4.6.4@aar'
    implementation 'cn.leancloud.android:qq-sdk:1.6.1-leancloud'
    implementation 'cn.leancloud.android:avoscloud-search:v4.6.4@aar'
    implementation 'com.android.support:recyclerview-v7:27.1.1'

    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

下一步进行初始化:

1、首先进入 控制台 > 设置 > 应用 Key 来获取 App ID 以及 App Key。

2、

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值