skip to Main Content

I am studying unit-testing from Google codelab.

https://developer.android.com/codelabs/advanced-android-kotlin-training-testing-basics#5

There is one step to choose the folder in AndroidTest/Test destination dialog
enter image description here

But my Android Studio doesn’t show this dialog so I need to drag my file into test package everytime.

How to set the Android Studio to let this dialog open?

2

Answers


    1. Update gradle & android gradle plugins
    2. Update all dependencies plugins ( I prefer to delete gradle variables and use dependencies with direct version number to avoid conflict )
      like this

    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1"

    1. Update kotolin version

    2. update target sdk to 33

    3. Add exported = "true" to the MainActivity tag in the manifest

        <activity
          android:name="com.example.android.architecture.blueprints.todoapp.tasks.TasksActivity"
          android:windowSoftInputMode="adjustResize"
          android:exported="true"
          android:theme="@style/AppTheme.OverlapSystemBar">
          <intent-filter>
              <action android:name="android.intent.action.MAIN" />
              <category android:name="android.intent.category.LAUNCHER" />
          </intent-filter>
      </activity>
      
    Login or Signup to reply.
  1. 1- Open file > project structure

    • update Android gradle plugin version to 4.2.2
    • update gradle version to 6.7.1

    2- When you create a test and the dialog appears to you then
    edit the destination package to the root package of the project
    for example, you will find the default package like this
    com.example.android.architecture.blueprints.todoapp.statistics
    remove .statistics
    make your destination package like this
    com.example.android.architecture.blueprints.todoapp

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search