Android Fotoapparat库

Android Fotoapparat库,android,Android,我是Android开发的新手,我想做一个摄像头应用程序。我找到了库(是Github页面) 但是我不知道如何实现一个库。我遵循了步骤(方法2),但在一个名为“IDE致命错误”的弹出窗口中出现了一个错误。它说:“为了调查/修复问题,IDE希望将以下文件附加到错误报告中。我们建议包括提供最大信息的所有文件。注意:您发送的所有数据都将保密。然后我可以选择“diagnostic.txt”。有一个“文件内容”部分,其中写入了“rootsChanged”。我可以向谷歌报告整个窗口 以下步骤是配置“Fotoap

我是Android开发的新手,我想做一个摄像头应用程序。我找到了库(是Github页面)

但是我不知道如何实现一个库。我遵循了步骤(方法2),但在一个名为“IDE致命错误”的弹出窗口中出现了一个错误。它说:“为了调查/修复问题,IDE希望将以下文件附加到错误报告中。我们建议包括提供最大信息的所有文件。注意:您发送的所有数据都将保密。然后我可以选择“diagnostic.txt”。有一个“文件内容”部分,其中写入了“rootsChanged”。我可以向谷歌报告整个窗口

以下步骤是配置“Fotoapparat”实例。什么是实例?当我在谷歌上搜索时,我只找到一些关于建立图书馆的文章


我很抱歉,如果这些都是愚蠢的问题,但我是一个初学者,我想了解更多关于Android开发。提前感谢您的时间和帮助。

在build.gradle(模块:app)文件中添加这一行->

然后开始使用你的代码。图书馆运转良好

编辑->

您需要学习java的基础知识

要设置对象的实例,需要创建一个变量

因此,在你的情况下:

Fotoapparat yourVariableName = new FotoapparatFotoapparat
    .with(context)  
    .into(cameraView)           // view which will draw the camera preview
    .previewScaleType(ScaleType.CenterCrop)  // we want the preview to fill the view  
    .photoResolution(ResolutionSelectorsKt.highestResolution())   // we want to have the biggest photo possible
    .lensPosition(LensPositionSelectorsKt.back())       // we want back camera
    .focusMode(SelectorsKt.firstAvailable(  // (optional) use the first focus mode which is supported by device
            FocusModeSelectorsKt. continuousFocusPicture(),
            FocusModeSelectorsKt.autoFocus(),        // in case if continuous focus is not available on device, auto focus will be used
            FocusModeSelectorsKt.fixed()             // if even auto focus is not available - fixed focus mode will be used
    ))
    .flash(SelectorsKt.firstAvailable(      // (optional) similar to how it is done for focus mode, this time for flash
            FlashSelectorsKt.autoRedEye(),
            FlashSelectorsKt.autoFlash(),
            FlashSelectorsKt.torch()
    ))
    .frameProcessor(myFrameProcessor)   // (optional) receives each frame from preview stream
    .logger(LoggersKt.loggers(            // (optional) we want to log camera events in 2 places at once
            LoggersKt.logcat(),           // ... in logcat
            LoggersKt.fileLogger(this)    // ... and to file
    ))
    .build();

然后开始使用
yourVariableName

为什么不从简单的开始呢?在掌握了基础知识后,您可以转到更高级的内容。别忘了同步Gradle文件。那么实例呢?请参阅我上面的编辑。谢谢代码。我做了一些研究(使用关键字“java实例”而不是“android实例”),我想我明白了。带的.仍为红色。我该怎么办?@Anton,我的“.with”也有同样的问题,你是怎么解决的?
Fotoapparat yourVariableName = new FotoapparatFotoapparat
    .with(context)  
    .into(cameraView)           // view which will draw the camera preview
    .previewScaleType(ScaleType.CenterCrop)  // we want the preview to fill the view  
    .photoResolution(ResolutionSelectorsKt.highestResolution())   // we want to have the biggest photo possible
    .lensPosition(LensPositionSelectorsKt.back())       // we want back camera
    .focusMode(SelectorsKt.firstAvailable(  // (optional) use the first focus mode which is supported by device
            FocusModeSelectorsKt. continuousFocusPicture(),
            FocusModeSelectorsKt.autoFocus(),        // in case if continuous focus is not available on device, auto focus will be used
            FocusModeSelectorsKt.fixed()             // if even auto focus is not available - fixed focus mode will be used
    ))
    .flash(SelectorsKt.firstAvailable(      // (optional) similar to how it is done for focus mode, this time for flash
            FlashSelectorsKt.autoRedEye(),
            FlashSelectorsKt.autoFlash(),
            FlashSelectorsKt.torch()
    ))
    .frameProcessor(myFrameProcessor)   // (optional) receives each frame from preview stream
    .logger(LoggersKt.loggers(            // (optional) we want to log camera events in 2 places at once
            LoggersKt.logcat(),           // ... in logcat
            LoggersKt.fileLogger(this)    // ... and to file
    ))
    .build();