endmr11 / ed_screen_recorder

Screen recorder plugin for Flutter. Supports IOS and Android devices.
MIT License
26 stars 35 forks source link

android error and app crash #19

Closed jaish702 closed 2 years ago

jaish702 commented 2 years ago

Note: D:\src\flutter.pub-cache\hosted\pub.dartlang.org\ed_screen_recorder-0.0.11\android\src\main\java\com\ed_screen_recorder\ed_screen_recorder\EdScreenRecorderPlugin.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.

endmr11 commented 2 years ago

This is not a mistake. The Register function has not been removed to support older versions. Can you send a more detailed log?

jaish702 commented 2 years ago

This is my flutter Latest version .

flutter doctor Waiting for another flutter command to release the startup lock... Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel master, 3.1.0-0.0.pre.1582, on Microsoft Windows [Version 10.0.19043.1766], locale en-IN) Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.4) [√] Android Studio (version 2021.2) [√] VS Code (version 1.69.0) [√] Connected device (3 available) [√] HTTP Host Availability

I have check the terminal when I use to run my app on emulator it's start showing this:-

Note: D:\src\flutter.pub-cache\hosted\pub.dartlang.org\ed_screen_recorder-0.0.11\android\src\main\java\com\ed_screen_recorder\ed_screen_recorder\EdScreenRecorderPlugin.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.

in terminal and when however my app build and installed on emulator it's stop working and when I tried to close the app and reopen it .it's start doing crash and app get's close's.( it's simply mean's that the app is not working since it install on the Emulator). the package is working amazing yesterday but today not will. and one more thing this same thing is happening on ios also.

endmr11 commented 2 years ago

Please heed the warnings. It says clear cache. Please use the Flutter Clean command. Have a nice day. :)

endmr11 commented 2 years ago

IOS Emulator does not support it. It only supports Android Emulator. But make sure it works and try it on a real device.

jaish702 commented 2 years ago

hi once again I am having the same problem. but when as you say in the above statement I have done the the same thing it's work but when I created the new project then in my existing project it's showing the same error so for helping you to understand the problem .this is my code :-

import 'dart:io'; import 'package:ed_screen_recorder/ed_screen_recorder.dart'; import 'package:firebase_storage/firebase_storage.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart';

class Textspeech extends StatefulWidget { const Textspeech({super.key});

@override State createState() => _TextspeechState(); }

class _TextspeechState extends State { File? file; EdScreenRecorder? screenRecorder; uploadvideo() async { final ref = FirebaseStorage.instance.ref().child("dd"); UploadTask uploadTask = ref.putFile(file!); final snapshot = await uploadTask.whenComplete(() {}); final urldownload = await snapshot.ref.getDownloadURL(); // ignore: avoid_print print("download video $urldownload"); }

Future pauseRecord() async { try { await screenRecorder?.pauseRecord(); } on PlatformException { kDebugMode ? debugPrint("Error: An error occurred while pause recording.") : null; } }

Future resumeRecord() async { try { await screenRecorder?.resumeRecord(); } on PlatformException { kDebugMode ? debugPrint("Error: An error occurred while resume recording.") : null; } }

@override void initState() { super.initState(); screenRecorder = EdScreenRecorder(); }

@override Widget build(BuildContext context) { return Scaffold( body: Container( height: double.infinity, width: double.infinity, color: Colors.black87, child: Column( children: [ ElevatedButton( onPressed: () async { try { await screenRecorder?.startRecordScreen( fileName: 'jaish', audioEnable: true, dirPathToSave: uploadvideo()); } on PlatformException { kDebugMode ? debugPrint( "Error: An error occurred while starting the recording!") : null; } }, child: const Text("Start video")), ElevatedButton( onPressed: () => resumeRecord(), child: const Text('RESUME RECORD')), ElevatedButton( onPressed: () => pauseRecord(), child: const Text('PAUSE RECORD')), ElevatedButton( onPressed: () async { try { await screenRecorder?.stopRecord(); await screenRecorder?.fileWatcherStart(file!); final ref = FirebaseStorage.instance.ref().child("dd"); UploadTask uploadTask = ref.putFile(file!); final snapshot = await uploadTask.whenComplete(() {}); final urldownload = await snapshot.ref.getDownloadURL(); // ignore: avoid_print print("download video $urldownload"); } on PlatformException { kDebugMode ? debugPrint( "Error: An error occurred while stopping recording.") : null; } }, child: const Text("Stop video")) ], ), ), ); } }

this is my build.gradel :-

def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } }

def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") }

def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' }

def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' }

apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply plugin: 'com.google.gms.google-services'

android { compileSdkVersion 31

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = '1.8'
}

sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.example.screenre123"
    minSdkVersion 23
    targetSdkVersion 30
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    multiDexEnabled true
}

buildTypes {
    release {
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.debug
    }
}

}

flutter { source '../..' }

dependencies { implementation 'androidx.appcompat:appcompat:1.4.1' implementation "androidx.multidex:multidex:2.0.1" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation platform('com.google.firebase:firebase-bom:30.0.0') implementation 'com.google.firebase:firebase-analytics' implementation 'com.github.HBiSoft:HBRecorder:2.0.4' }

and one more thing is that when I had eyes on you code I found that you said in readme that implementation 'com.github.HBiSoft:HBRecorder:2.0.3' but you use implementation 'com.github.HBiSoft:HBRecorder:2.0.4' I am getting same problem from both.