Skip to content

Commit

Permalink
Merge pull request #11 from UnPourTous/master
Browse files Browse the repository at this point in the history
修改Android QQ AppId的设置位置
  • Loading branch information
iVanPan authored Jul 2, 2017
2 parents d8a6ada + b49a53e commit be1cda8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ out/

# Gradle files
.gradle/
gradle/
build/
gradlew
gradlew.bat

# Local configuration file (sdk path, etc)
local.properties
Expand All @@ -41,6 +44,7 @@ captures/
.idea/workspace.xml
.idea/tasks.xml
.idea/libraries
.idea/

# Keystore files
*.jks
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,13 @@ npm install --save react-native-qqsdk@latest
compile project(':react-native-qqsdk')
}
```
3. add App ID to `android/app/build.gradle` which locate in react-native-qqsdk node_modules folder
3. add App ID to `$RNProjectRoot/package.json`
```gradle
...
manifestPlaceholders = [
QQ_APP_ID: ${QQ_APP_ID}, //在此替换你的APPKey
]
```
``` json
{
"qq_app_id": "YOUR_QQ_APP_ID"
}
```
4.Update the `MainApplication.java` file to use react-native-qqsdk via the following changes:

Expand Down
8 changes: 7 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ def computeVersionName() {
def json = slurper.parse(file('../../../package.json'), "utf-8")
return json.version
}
def computeQQAppId() {
// dynamically retrieve qq app id from package.json
def slurper = new JsonSlurper()
def json = slurper.parse(file('../../../package.json'), "utf-8")
return json.qq_app_id
}
apply plugin: 'com.android.library'

android {
Expand All @@ -18,7 +24,7 @@ android {
versionCode 1
versionName computeVersionName()
manifestPlaceholders = [
QQ_APP_ID: ${QQ_APP_ID}, //在此替换你的APPKey
QQ_APP_ID: computeQQAppId()
]
}
sourceSets.main {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-qqsdk",
"version": "0.7.9",
"version": "0.8.1",
"description": "react-native wrapper for qq sdk",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit be1cda8

Please sign in to comment.