1. 程式人生 > >第三方應用使用微博登入授權功能注意事項

第三方應用使用微博登入授權功能注意事項

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/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... 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')
    }