第三方应用使用微博登录授权功能注意事项

1. 申请应用之后,在应用信息的高级信息中填写授权回调页,默认填写https://api.weibo.com/oauth2/default.html。

2. android studio导入WeiboSDK之后,要将libs下的.so文件全部导入工程的libs文件夹下,并在应用的build.gradle中加上这段代码,尤其注意:jniLibs.srcDirs = ['libs'],指明了jni库放在libs下面(如果是放在新建的文件夹中,后面的‘libs'需要换成那个文件夹的名字。这一行加的位置在android->sourceSets->main下面。那里定义了java.srcDirs, resources.srcDirs等路径(导入Android Studio时自动生成的),否则会出现闪退的情况。

sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['libs']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src//... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }


你可能感兴趣的:(Android)