Skip to content

Android sdk versions 5 & 6 video upload failure "Unfortunately, Camera has stopped" #205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.71'
ext.kotlin_version = '1.6.0'
ext.buildToolsVersion = "30.0.3"
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
}
}

allprojects {
repositories {
jcenter()
mavenLocal()
jcenter()
google()
Expand Down
11 changes: 5 additions & 6 deletions filestack/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
plugins {
id 'com.github.dcendents.android-maven' version '2.0'
id 'com.jfrog.bintray' version '1.7.3'
}

Expand All @@ -11,11 +10,11 @@ version = '5.3.0'
project.archivesBaseName = 'filestack-android'

android {
compileSdkVersion 28
compileSdkVersion 31

defaultConfig {
minSdkVersion 16
targetSdkVersion 28
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName version

Expand Down Expand Up @@ -43,7 +42,7 @@ dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'

implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'

Expand Down Expand Up @@ -112,4 +111,4 @@ bintray {
released = new Date()
}
}
}
}
1 change: 1 addition & 0 deletions filestack/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<activity
android:name=".FsActivity"
android:launchMode="singleTop"
android:exported="true"
android:label="@string/filestack__picker_title"
android:theme="@style/FilestackNoActionBar">

Expand Down
12 changes: 8 additions & 4 deletions filestack/src/main/java/com/filestack/android/FsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,11 @@ protected void onStop() {
super.onStop();
SharedPreferences preferences = getPreferences(MODE_PRIVATE);

String sessionToken = Util.getClient().getSessionToken();
preferences.edit().putString(PREF_SESSION_TOKEN, sessionToken).apply();
if (Util.getClient() != null) {
String sessionToken = Util.getClient().getSessionToken();
preferences.edit().putString(PREF_SESSION_TOKEN, sessionToken).apply();
}

Util.getSelectionSaver().setItemChangeListener(null);
}

Expand Down Expand Up @@ -266,8 +269,9 @@ public boolean onCreateOptionsMenu(Menu menu) {
menu.findItem(R.id.action_about).setVisible(showVersionInfo);
for (int i = 0; i < menu.size(); i++) {
MenuItem item = menu.getItem(i);
Drawable drawable = DrawableCompat.wrap(item.getIcon());
if (drawable != null) {
Drawable icon = item.getIcon();
Drawable drawable = DrawableCompat.wrap(icon);
if (icon != null && drawable != null) {
drawable.setColorFilter(theme.getBackgroundColor(), PorterDuff.Mode.SRC_ATOP);
DrawableCompat.setTint(drawable, theme.getBackgroundColor());
item.setIcon(drawable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ class CloudListAdapter extends RecyclerView.Adapter<CloudListViewHolder> impleme
currentPath = saveInstanceState.getString(STATE_CURRENT_PATH);
folders = (HashMap) saveInstanceState.getSerializable(STATE_FOLDERS);
nextTokens = (HashMap) saveInstanceState.getSerializable(STATE_NEXT_TOKENS);
if (folders == null || folders.get(currentPath) == null) {
folders.put(currentPath, new ArrayList<CloudItem>());
}
} else {
folders = new HashMap<>();
nextTokens = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private FileLink upload(Selection selection, StorageOptions baseOptions) {
String mimeType = selection.getMimeType();

StorageOptions options = baseOptions.newBuilder()
.filename(name)
.filename(baseOptions.getFilename() + name)
.mimeType(mimeType)
.build();

Expand Down
11 changes: 9 additions & 2 deletions filestack/src/main/java/com/filestack/android/internal/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.support.v4.content.FileProvider;
import android.support.v4.content.MimeTypeFilter;
Expand Down Expand Up @@ -188,8 +189,14 @@ public static File createMovieFile(Context context) throws IOException {
// If we don't do this, we'll get the exception when sending the URI to the camera app
// See the FileProvider example in https://developer.android.com/training/camera/photobasics
public static Uri getUriForInternalMedia(Context context, File file) {
String authority = context.getPackageName() + ".fileprovider";
return FileProvider.getUriForFile(context, authority, file);
Uri uri;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
String authority = context.getPackageName() + ".fileprovider";
uri = FileProvider.getUriForFile(context, authority, file);
} else {
uri = Uri.fromFile(file);
}
return uri;
}

// TODO This doesn't seem to work
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
android.debug.obsoleteApi=true

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
4 changes: 2 additions & 2 deletions samples/form/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ android {
compileSdkVersion 27
defaultConfig {
applicationId "com.filestack.android.samples.form"
minSdkVersion 19
targetSdkVersion 27
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand Down
4 changes: 2 additions & 2 deletions tester/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ android {

defaultConfig {
applicationId "com.filestack.android.demo"
minSdkVersion 16
targetSdkVersion 28
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.0"

Expand Down
3 changes: 2 additions & 1 deletion tester/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
android:theme="@style/AppTheme">

<activity
android:name=".MainActivity">
android:name=".MainActivity"
android:exported="true">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down