Simplify testing your IoT projects by using your Android device to send commands to Arduino through USB.
Ever thought of testing your Arduino project on the go without using a lap top?
Sometimes, you just want to send simple commands to an Arduino through USB without getting that 1.4 kilogram laptop out of the bag! 😉
Especially if the Android phone in your pocket has enough resources to do that!
This is being done as a hobby, and for experimenting, so probably there might be some flaws; As an example, the vendor ID of Arduino is set to only work with Arduino devices, but this is my use case and please feel free to change it to match your needs. Or if you have a great idea to make this dynamic wile keeping the app simple, please feel free to open a pull request!
The app is available for free on Google Play Store (Arduino USB Terminal). Otherwise, you can clone the project and run it locally. Please read the Sentry Reports part on this page before running the project to avoid build failures.
You can run all the instrumented tests using a Gradle Managed Device in one line:
./gradlew pixel2api30DebugAndroidTest
This command will run an Android emulator on the background and run all the tests. After a successful run, the test coverage file will be available in your build folder:
app/build/outputs/managed_device_code_coverage/pixel2api30/coverage.ec
To create a unified coverage report you can use the Jacoco task:
./gradlew jacocoTestReport
// Jacoco HTML and XML output will be under the following path:
app/build/mergedReportDir/jacocoTestReport
Gradle automatically recognizes your environment and configures, runs, and closes the emulator in the background. This has been tested on environments with Arm (Apple M1) and Intel CPUs.
More info about Gradle managed devices in official Android testing docs: Scale your tests with Gradle Managed Devices
The project uses Firebase Crashlytics for the crash reports, therefore you will need to create a free Firebase project to use it.
- Once you create a Firebase project, Firebase will provide you with a config file (
google-services.json
). - Place your
google-services.json
file under theapp/
directory and build the project to activate it.
More info on Firebase official docs for getting started with Firebase Crashlytics
If this is not needed, you can remove the crashlytics dependency in project leve and app level build.gradle files.
- remove
classpath "com.google.firebase:firebase-crashlytics-gradle:2.9.4"
frombuild.gradle
file - remove
implementation("com.google.firebase:firebase-crashlytics-ktx")
fromapp/build.gradle.kts
file
The project uses Sonar Cloud manual analysis to detect code smells and potential bugs
To run the manual analysis locally, use the gradle sonar
task:
./gradlew sonar
Since this uses the gradle scanner, the sonar properties are defined in root project's build.gradle
file.
On one hand, the Sonar scanner requires local paths for sonar.sources
and sonar.binaries
properties, on the other hand it requires absolute path for sonar.androidLint.reportPaths
and sonar.coverage.jacoco.xmlReportPaths
.
More info on official Sonar docs: SonarScanner for Gradle
- Please feel free inform me about new issues
Suggestions and PRs are welcome! :)