diff --git a/Example/android/app/build.gradle b/Example/android/app/build.gradle index 99efe88..b64e28d 100644 --- a/Example/android/app/build.gradle +++ b/Example/android/app/build.gradle @@ -137,11 +137,11 @@ android { } dependencies { - compile project(':react-native-image-picker') - compile project(':aliyun-oss-react-native') - compile fileTree(dir: "libs", include: ["*.jar"]) - compile "com.android.support:appcompat-v7:23.0.1" - compile "com.facebook.react:react-native:+" // From node_modules + implementation project(':react-native-image-picker') + implementation project(':aliyun-oss-react-native') + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation "com.android.support:appcompat-v7:23.0.1" + implementation "com.facebook.react:react-native:+" // From node_modules } // Run this once to be able to run the application with BUCK diff --git a/android/build.gradle b/android/build.gradle index 261655d..e405066 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -31,7 +31,7 @@ repositories { } dependencies { - compile 'com.facebook.react:react-native:+' - compile 'com.aliyun.dpa:oss-android-sdk:+' + implementation 'com.facebook.react:react-native:+' + implementation 'com.aliyun.dpa:oss-android-sdk:+' } - \ No newline at end of file + diff --git a/android/src/main/java/com/reactlibrary/AliyunUploadManager.java b/android/src/main/java/com/reactlibrary/AliyunUploadManager.java index 2d08bfa..a852643 100644 --- a/android/src/main/java/com/reactlibrary/AliyunUploadManager.java +++ b/android/src/main/java/com/reactlibrary/AliyunUploadManager.java @@ -94,7 +94,8 @@ public void asyncUpload(final ReactContext context, String bucketName, String os // init upload request PutObjectRequest put = new PutObjectRequest(bucketName, ossFile, sourceFile); ObjectMetadata metadata = new ObjectMetadata(); - metadata.setContentType("application/octet-stream"); + + metadata.setContentType(options.hasKey("content-type") ? options.getString("content-type") : "application/octet-stream"); put.setMetadata(metadata); // set callback