Configuration of AWS CodePipeline for Android CI/CD
The indentation looks incorrect for the artifacts section in your buildspec-test.yml file. It is nested under the phases section. That way it is not being output properly and can't be picked up by the next build.

It should be the same as in your second file.

version: 0.2
phases:
  build:
    commands:
      - $ANDROID_HOME/tools/bin/sdkmanager "build-tools;27.0.3" "platforms;android-27"
      - sh gradlew assembleDebug
artifacts:
  files:
    - app/build/outputs/apk/debug/app-debug.apk
  #some other stuff here.