CameraX aims to demonstrate how to use CameraX APIs written in Kotlin.
CameraX is a Jet-pack support library, built to help you make camera app development easier. It provides a consistent and easy-to-use API surface that works across most Android devices, with backward-compatibility to Android 5.0 (API level 21).
- Ease of use
- Consistency across devices
- New camera experiences
While it leverages the capabilities of camera2, it uses a simpler, uses a case-based approach that is lifecycle-aware. It also resolves device compatibility issues for you so that you don't have to include device-specific code in your codebase. These features reduce the amount of code you need to write when adding camera capabilities to your app.
Lastly, CameraX enables developers to leverage the same camera experiences and features that pre-installed camera apps provide, with as little as two lines of code. CameraX Extensions are optional add-ons that enable you to add effects like Portrait, HDR, Night, and Beauty within your application on supported devices.
To build the app directly from the command line, run:
./gradlew assembleDebug
Unit testing and instrumented device testing share the same code. To test the app using Roboelectric, no device required, run:
./gradlew test
To run the same tests in an Android device connected via ADB, run:
./gradlew connectedAndroidTest
Alternatively, test running configurations can be added to Android Studio for convenience (and a nice UI). To do that:
- Go to:
Run
>Edit Configurations
>Add New Configuration
. - For Roboelectric select
Android JUnit
, for connected device selectAndroid Instrumented Tests
. - Select
app
module andcom.arindam.camerax.MainInstrumentedTest
class. - Optional: Give the run configuration a name, like
test roboelectric
ortest device
Support it by clicking the ⭐ button on the upper right of this page. ✌️
Implement photo editor, live filters and face detection. Add many more features and bug fixes.
Copyright (C) 2019 Arindam Karmakar, Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
All pull requests are welcome, make sure to follow the contribution guidelines when you submit pull request.