Migrate CircleCI from 1.0 to 2.0 for an Android application

android
circle.yml

#1

Hello,there!
I am working for an open source project which build on 1.0 config. Now I would like it to migrate it to 2.0 .
I’ve read the docs but I need a push up help in order to complete the migration

version: 2
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-27-alpha
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- restore_cache:
key: jars-{{ checksum “build.gradle” }}-{{ checksum “app/build.gradle” }}
- run:
name: Add SDK 28
command: echo yes | ${ANDROID_HOME}/tools/bin/sdkmanager “platforms;android-28”
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum “build.gradle” }}-{{ checksum “app/build.gradle” }}
- run:
name: lint check
command: ./gradlew lint
- run:
name: spotless check
command: ./gradlew spotlessCheck
- run:
name: Run Tests
command: ./gradlew build
- run:
command:
bash exec/prep-key.sh
- run:
command:
bash exec/apk-gen.sh
- store_artifacts:
path: app/build/reports
destination: reports
- store_artifacts:
path: app/build/outputs
destination: outputs
- store_test_results:
path: app/build/test-results

This is my circleCI for version 1.0

Kindly help


#2

Hi there. Would you please add formatting to your post? This will allow readers to see the structure of the document, and to see if the spacing is correct.

Markdown is used here, so you can do this with triple backticks:

```
your
    yaml
        here
```

Also, if you can be more specific about what sort of help you need, that is very useful. Does a step fail? If so, which one, and what is the nature of the failure?


#3

Hello,there!
Thanks for the response

version: 2
jobs:
  build:
    working_directory: ~/code
    docker:
      - image: circleci/android:api-27-alpha
    environment:
      JVM_OPTS: -Xmx3200m
    steps:
      - checkout
      - restore_cache:
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
      - run:
          name: Add SDK 28
          command: echo yes | ${ANDROID_HOME}/tools/bin/sdkmanager "platforms;android-28"
      - run:
          name: Download Dependencies
          command: ./gradlew androidDependencies
      - save_cache:
          paths:
            - ~/.gradle
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
      - run:
          name: lint check
          command: ./gradlew lint
      - run:
          name: spotless check
          command: ./gradlew spotlessCheck
      - run:
          name: Run Tests
          command: ./gradlew build
      - run:
          command:
            bash exec/prep-key.sh
      - run:
          command:
            bash exec/apk-gen.sh
      - store_artifacts:
          path: app/build/reports
          destination: reports
      - store_artifacts:
          path: app/build/outputs
          destination: outputs
      - store_test_results:
          path: app/build/test-results

Sir,this is my circle.YML file in version 1.0.I want to migrate it to 2.0 .My doubt is, will following
https://circleci.com/docs/2.0/language-android/#sample-configuration
this guidelines solve the problem?
Kindly reply.


#4

Please,anyone could help ?


#5

I don’t think it is clear what you are asking. What specific problem are you experiencing? Do you get an error of some kind? What happens when this 2.x configuration is run? (I asked this before).