TouchBoarder
TouchBoarder

Reputation: 6492

Android Studio 2.0 (Preview 3b) layout xml changes not updated in apk?

When I do changes to a layout resource file it's not updated/reflected when the apk file is buildt and installed from Android Studio 2.0 (Preview 3b).

Example: I had a EditText and I added a TextInputLayout like this:

<android.support.design.widget.TextInputLayout
    android:id="@+id/input_layout_new_password"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="8dp">

    <EditText
        android:id="@+id/edit_text_new_password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/hint_your_new_password"
        android:inputType="textPassword"
        android:saveEnabled="false" />

</android.support.design.widget.TextInputLayout>

The result after updating the app is the same as before I added the TextInputLayout, just the EditText without TextInputLayout.

What I've tried:

I suspect this is probably a bug with the Preview 3b version of Android Studio 2.0 causing this. Any ideas? Maybe it's just a settings/configuration?

Upvotes: 5

Views: 1280

Answers (4)

Cody
Cody

Reputation: 1879

This issue is typically caused by only updating the xml file in one layout folder and not the other folders containing the file's compatibility variants as well. For example, only editing the xml file in the layout system folder and not the layout-v14 folder too will cause this issue.

The fix: update the instance of the layout xml file not only in your layout folder, but the instances in all other layout folders too (layout-v14, layout v-21, etc.)

Upvotes: 1

SafalFrom2050
SafalFrom2050

Reputation: 727

Also make sure you make the changes in the layout-v<target-api> folder if you have set specific layout for specific api level. For example layout-v23 in mine case.

Upvotes: 1

James Lau
James Lau

Reputation: 169

I wasn't able to reproduce this issue. I tried the same layout changes with Preview 3b and the changes showed up in the emulator fine. I simply hit the run button again.

Was this working for you in a previous version of Android Studio?

Upvotes: 0

TouchBoarder
TouchBoarder

Reputation: 6492

Temporary solution: If you make a copy of the layout file and inflate it instead. Then the changes are updated in the app? But this is not ideally the best solution!

Upvotes: 2

Related Questions