Comments (12)
The crash was happening throughout all devices. This error was found in release mode with following values
signingConfig signingConfigs.release
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
resValue "string", "app_name", "@string/app_name_release"
debuggable false
and when I changed minifyEnabled to false, the crash stopped happening.
from android-video-trimmer.
send the video uri and code that you used to trim the video
from android-video-trimmer.
Can you share the device details
from android-video-trimmer.
Add this proguard rules
-dontwarn com.gowtham.library**
-keep class com.gowtham.library** { *; }
-keep interface com.gowtham.library** { *; }
from android-video-trimmer.
Already added this proguard rules but it still doesn't work.
from android-video-trimmer.
I don't know what went wrong? try this solution . are you using jitpack dependency or your own pulled code
from android-video-trimmer.
Jitpack dependency is added.
The crash is happening in the sample code as well.
from android-video-trimmer.
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode != Activity.RESULT_OK) {
return
}
try {
if (requestCode == VideoUtil.VideoSource.VIDEO_GALLERY) {
val uri = data?.data
filePathUri = uri
viewModel.videoPath.value = getRealPathFromUri(uri)
Log.d("URI:", "" + getRealPathFromUri(uri))
Toast.makeText(this@UploadVideoActivity, "Video uploaded.", Toast.LENGTH_LONG).show()
uploadedVideo.setVideoURI(uri)
uploadedVideo.setOnPreparedListener(MediaPlayer.OnPreparedListener { mp ->
mp.setOnVideoSizeChangedListener { mp, width, height ->
var mc = MediaController(this@UploadVideoActivity)
mc.show(5000)
uploadedVideo.setMediaController(mc)
mc.setAnchorView(uploadedVideo)
}
})
uploadedVideo.start()
} else if (requestCode == TrimVideo.VIDEO_TRIMMER_REQ_CODE && data != null) {
val uri = Uri.parse(TrimVideo.getTrimmedVideoPath(data))
Log.d("URI:", "" + uri)
viewModel.videoPath.value = uri.toString()
Log.d(TAG, "Trimmed path:: $uri")
uploadedVideo!!.setMediaController(mediaController)
uploadedVideo.setVideoURI(uri)
uploadedVideo.requestFocus()
uploadedVideo.start()
val filepath = uri.toString()
val file = File(filepath)
val length = file.length()
Log.d(TAG, "Video size:: " + length / 1024)
}
} catch (e: Exception) {
e.printStackTrace()
}
}
fun getRealPathFromUri(contentUri: Uri?): String? {
var cursor: Cursor? = null
return try {
val proj = arrayOf(MediaStore.Video.Media.DATA)
cursor = contentUri?.let { contentResolver.query(it, proj, null, null, null) }
assert(cursor != null)
val columnIndex: Int = cursor!!.getColumnIndexOrThrow(MediaStore.Video.Media.DATA)
cursor!!.moveToFirst()
cursor!!.getString(columnIndex)
} finally {
if (cursor != null) {
cursor.close()
}
}
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.menu_upload_cropped_video, menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.menu_crop_video -> {
onDefaultTrimClicked()
}
}
return true
}
private fun openTrimActivity(data: String) {
if (trimType == 0) {
mFile = Date().time.toString()
TrimVideo.activity(data)
//.setCompressOption(new CompressOption()) //pass empty constructor for default compress option
.setDestination("/storage/emulated/0/DCIM/TESTFOLDER")
.setFileName(mFile)
.start(this)
Log.v("mFile:", mFile)
}
}
private fun onDefaultTrimClicked() {
trimType = 0
if (checkCamStoragePer()) {
openTrimActivity(filePathUri.toString())
}lĖĨ
}
private fun checkCamStoragePer(): Boolean {
return checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.CAMERA)
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (isPermissionOk(grantResults)) {
onDefaultTrimClicked()
}
}
private fun isPermissionOk(grantResults: IntArray): Boolean {
var isAllGranted: Boolean = true
for (result in grantResults) {
if (PackageManager.PERMISSION_GRANTED != result) {
isAllGranted = false
break
}
}
return isAllGranted
}
private fun checkPermission(vararg permissions: String): Boolean {
var allPermitted = false
for (permission in permissions) {
allPermitted = (ContextCompat.checkSelfPermission(this, permission)
=== PackageManager.PERMISSION_GRANTED)
if (!allPermitted) break
}
if (allPermitted) return true
ActivityCompat.requestPermissions(this, permissions,
220)
return false
}
from android-video-trimmer.
Heloooo Guys.
Any update on this ..?
I'm also facing the same issue ,only when we add proguard rules. (minifyEnabled true)
Crash catch in analytics
Fatal Exception: java.lang.IllegalArgumentException
com.gowtham.library.ui.ActVideoTrimmer.getCompressionCommand
android.media.MediaMetadataRetriever.setDataSource (MediaMetadataRetriever.java:77)
com.gowtham.library.ui.ActVideoTrimmer.getCompressionCommand (ActVideoTrimmer.java:502)
com.gowtham.library.ui.ActVideoTrimmer.validateVideo (ActVideoTrimmer.java:485)
com.gowtham.library.ui.ActVideoTrimmer.onOptionsItemSelected (ActVideoTrimmer.java:456)
android.app.Activity.onMenuItemSelected (Activity.java:4137)
androidx.fragment.app.FragmentActivity.onMenuItemSelected (FragmentActivity.java:383)
androidx.appcompat.app.AppCompatActivity.onMenuItemSelected (AppCompatActivity.java:219)
androidx.appcompat.view.WindowCallbackWrapper.onMenuItemSelected (WindowCallbackWrapper.java:109)
androidx.appcompat.view.WindowCallbackWrapper.onMenuItemSelected (WindowCallbackWrapper.java:109)
androidx.appcompat.app.ToolbarActionBar$2.onMenuItemClick (ToolbarActionBar.java:64)
androidx.appcompat.widget.Toolbar$1.onMenuItemClick (Toolbar.java:207)
androidx.appcompat.widget.ActionMenuView$MenuBuilderCallback.onMenuItemSelected (ActionMenuView.java:781)
androidx.appcompat.view.menu.MenuBuilder.dispatchMenuItemSelected (MenuBuilder.java:840)
androidx.appcompat.view.menu.MenuItemImpl.invoke (MenuItemImpl.java:158)
androidx.appcompat.view.menu.MenuBuilder.performItemAction (MenuBuilder.java:991)
androidx.appcompat.view.menu.MenuBuilder.performItemAction (MenuBuilder.java:981)
androidx.appcompat.widget.ActionMenuView.invokeItem (ActionMenuView.java:625)
androidx.appcompat.view.menu.ActionMenuItemView.onClick (ActionMenuItemView.java:151)
android.view.View.performClick (View.java:7140)
android.view.View.performClickInternal (View.java:7117)
android.view.View.access$3500 (View.java:801)
android.view.View$PerformClick.run (View.java:27355)
android.os.Handler.handleCallback (Handler.java:883)
android.os.Handler.dispatchMessage (Handler.java:100)
android.os.Looper.loop (Looper.java:214)
android.app.ActivityThread.main (ActivityThread.java:7397)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:492)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:935)
from android-video-trimmer.
It seems like your issue is different than this, this issue happens in FFmpeg native code but, your issue has happened in Video trimmer library. Can you create the issue as a new issue
from android-video-trimmer.
Thanks Gowtham.
I will create.
from android-video-trimmer.
Duplicate of #35
from android-video-trimmer.
Related Issues (20)
- Android 12 and above version carsh HOT 3
- TrimVideo class is not found HOT 1
- Could not find com.crystal:crystalrangeseekbar:1.1.3. HOT 2
- Please add this trimmer as Separate entity, Make a copy of this trimmer without FFmpeg
- Getting this error after adding the dependenecy HOT 1
- problem with jniLibs and CMake; HOT 3
- Error after adding library
- Linking error when adding the library HOT 2
- app size is 45 MB HOT 1
- Crash on all android version HOT 2
- Fatal Exception: java.lang.IllegalArgumentException HOT 1
- HOW TO USE THIS LIB WITHOUT PICKING VIDEO FROM GALLERY HOT 2
- I am suresh, while I taken video from internalstorage video and start to edit but getting crash.please help me HOT 9
- Minor issue, facing error if video file name contains '?' or '#' HOT 1
- How do we set the output destination?
- android 13 cant trim video permission denied.WRITE_EXTERNAL_SORAGE -> READ_EXTERNAL_VIDEO HOT 7
- allow setDestination to Cache directory HOT 2
- protocol not found. "failed to trim" HOT 5
- Not able to see the video in Chrome web browser after trimming. HOT 5
- minify enabled app crashes HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
đ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. đđđ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google â¤ī¸ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-video-trimmer.