Connect an Android phone

After setting up Android command-line tools, connect the phone to your development computer.

Enable Developer options and USB debugging on the phone. Connect the phone to your development computer with USB, unlock it, and accept the debugging authorization prompt.

Verify that your phone is listed in adb:

    

        
        
adb devices -l

    

The output lists the authorized phone and its device serial. If the phone reports unauthorized, unlock the phone and accept the debugging prompt. If the phone doesn’t appear, see Run apps on a hardware device .

Confirm that the phone uses the Arm64 Application Binary Interface (ABI) and runs Android 9 (API 28) or later:

    

        
        
adb shell getprop ro.product.cpu.abi
adb shell getprop ro.build.version.sdk

    

The first command should print arm64-v8a. The second command should print a version 28 or later.

Clone the application repository

Clone the repository with Git, then enter the project directory:

    

        
        
git clone https://github.com/arm-education/ai-portal-android-app-photo-upscaling.git
cd ai-portal-android-app-photo-upscaling

    

Run the remaining terminal commands in the Learning Path from this project directory.

Prepare the Arm AI Portal model downloader

The sample repository includes a downloader for its supported Arm AI Portal model packages. The packages are published by Arm and hosted in Arm Hugging Face repositories.

Create a Python virtual environment and install the package that’s used by the downloader:

    

        
        

python3 -m venv .hf-venv
.hf-venv/bin/python -m pip install "huggingface_hub==2.4.0"
  

    
    

        
        

python -m venv .hf-venv
.\.hf-venv\Scripts\python.exe -m pip install "huggingface_hub==2.4.0"
  

    

The later commands invoke the environment Python executable directly. The PowerShell script-execution policy therefore doesn’t need to be changed.

If Python reports that venv is unavailable on Debian or Ubuntu, install the python3-venv package and rerun the command.

Build and run the Photo Upscale application

Before building, confirm that Gradle is running with JDK 17:

    

        
        

./gradlew --version
  

    
    

        
        

.\gradlew.bat --version
  

    

The Launcher JVM and Daemon JVM entries should report version 17.

If either entry uses another version, set JAVA_HOME to your JDK 17 installation.

Stop the existing Gradle daemon before trying again:

    

        
        

./gradlew --stop
  

    
    

        
        

.\gradlew.bat --stop
  

    
Note

If the build fails and the error contains only a Java version number, Gradle is using an incompatible JDK. Set JAVA_HOME to JDK 17 and stop the Gradle daemon. Confirm the version with ./gradlew --version or .\gradlew.bat --version, and run the build again.

Use the Gradle wrapper to build and lint the debug Android package (APK):

    

        
        

chmod +x gradlew
./gradlew :app:assembleDebug :app:lintDebug
  

    
    

        
        

.\gradlew.bat :app:assembleDebug :app:lintDebug
  

    

You don’t need to install Gradle separately because the repository includes the wrapper.

Continue when Gradle reports BUILD SUCCESSFUL. The APK is created at app/build/outputs/apk/debug/app-debug.apk.

Install the APK and start Photo Upscale:

    

        
        
adb install -r app/build/outputs/apk/debug/app-debug.apk
adb shell am start -n org.arm.learningpath.upscaling/.MainActivity

    

The adb install -r command should report Success. The launch command should report that it started org.arm.learningpath.upscaling/.MainActivity.

Photo Upscale uses one ExecuTorch adapter for all supported models. Use Add or change model to load a model. Upscale photo remains unavailable until you import a supported model and choose a saved photo. Inspect detail and Save image appear after upscaling. Installing with adb install -r preserves models that were imported previously. On a first installation, the app reports Model setup needed.

Confirm that the application opens and shows Model setup needed, an empty photo preview, and an unavailable Upscale photo button:

Image Alt Text:Photo Upscale showing Model setup needed, an empty photo preview, and the disabled Upscale photo button.Photo Upscale before importing a model or choosing a photo

What you’ve accomplished and what’s next

You’ve connected an Arm-based Android phone, prepared the model downloader, and confirmed that Photo Upscale builds and starts.

Next, you’ll download an optimized upscaling model from the Arm AI Portal and upscale a saved photo.