developer tip

Android Studio가 앱에 변경 사항을 배포하지 않음

optionbox 2020. 8. 28. 07:21
반응형

Android Studio가 앱에 변경 사항을 배포하지 않음


때때로이 시나리오는 개발할 때 발생합니다. 소스 코드를 변경하고 모두 저장을 누른 다음 실행하지만 변경 사항이 앱에 분명히 반영되지 않습니다 (테스트를 위해 장치를 사용하고 있습니다). 내 장치에서 앱을 제거하고 다시 실행을 누르면 새로 설치된 앱이 여전히 소스 코드의 변경 사항을 반영하지 않습니다. 이런 일이 발생하면 소스를 편집하고 실행을 누르면 예상 한 변경 사항이있는 새 버전이 장치에있을 수 있습니다.

나는 또한 여기서 해결책을 시도했지만 자주 작동하지 않는 것 같습니다.

Android Studio-새로운 변경없이 내 앱 배포


나도 같은 문제가 있습니다. 이 스레드는 내가 검색했을 때 가장 먼저 나타납니다. Instant Run 기능을 사용하지 않고 해결했습니다. 최선의 해결책은 아니지만 지금은 작동합니다.

"파일-> 설정-> 빌드, 실행, 배포-> 즉시 실행"으로 이동하여 비활성화하십시오. 이 Android Studio는 매번 처음부터 빌드하지만 제대로 빌드하지 않는 것보다 낫습니다.

작은 폭언 : 거의 모든 Android Studio 버전에는 성가신 버그가 있습니다. 그들은 버전 2를 곧 출시 할 예정이지만 베타 버전은 여전히 ​​버그가 있습니다. 가까운 장래에 IDE가 안정화되기를 바랍니다.


어제 (2018-03-27) Android Studio가 3.0.1에서 3.1 로의 공식 업데이트를 게시했으며 많은 사람들 (나를 포함하여)이이 문제를 다시 겪기 시작하는 것 같습니다.

여기 # 5 댓글에 대한 크레딧 은 아래에서 해결 방법입니다.

Android Studio에서 Run> 로 이동합니다 Edit Configuration.

아래에서을 Before launch:찾을 수없는 경우 Gradle-aware Make아래와 같이 :

여기에 이미지 설명 입력

추가 Gradle-aware Make하고 비워 Task둡니다.

여기에 이미지 설명 입력

경고 :이 조치가 의미하는 바가 무엇인지, 부작용이 있는지 여부를 모르겠습니다. 누군가가 그것에 대해 더 많은 설명을 할 수 있는지 감사하십시오!

편집하다

참조 된 @ChristopherSmit 덕분 에이 페이지Gradle-aware make"프로젝트 컴파일 및 Gradle 실행" 의미합니다.
처음 Run에는 코드가 변경되지 않은 경우에도 시간이 더 오래 걸릴 수 있다고 생각합니다 . 그러나 테스트 후 코드가 변경되지 않으면 두 번째 시간이 훨씬 더 빠릅니다.
AS 3.1을 사용하여 새 프로젝트를 만드는 경우 이것이 기본 옵션이라는 사실을 감안할 때이 구성이 매우 안전하다고 생각합니다.


Android Studio 2.0.0을 사용하여 동일한 문제가 발생하여 프로젝트 다시 빌드 하여 해결했습니다 .

Build > Rebuild Project

GUI 그림

또는 Clean and Rerun

Run > Clean and Rerun

청소 및 재실행


내 변경 사항이 모든 관련 파일에 전파되어서는 안된다는 것을 깨달을 때까지 이것은 진짜 걸림돌이었습니다 ...

If you're having trouble with layouts, as I was, you may find that you need to update the layout in the res > layout-v17 folder. I had made changes via the Design View in the layout folder and those changes seemed to be propagated automatically to layout-v17, initially. However, later changes WEREN'T.

Check your res > layout-v17 folder and see if the .xml files in that folder reflect the changes you are seeing in your res > layout folder. You will probably find that they don't. Fix this and re-deploy. Like me, you should see the new code mods.

Hope this helps.


For now I solved the issue by closing the app and run again. It worked like a charm. Not sure yet if it is a coincidence, but i guess it worths give it a try.

I really wonder if it works some other people too. Lets give it a try and let me know.


For me instant run was a nightmare, 2-5 minute build times, and maddeningly often, recent changes were not included in builds. I highly recommend disabling instant run and adding this line to gradle.properties:

android.enableBuildCache=true

First build often takes some time for large projects (1-2mins), but after it's cached subsequent builds are usually lightnight fast (<10secs).

Got this tip from reddit user /u/QuestionsEverythang which has saved me SO much hassling around with instant run!


Make sure you do not have an alternative layout. If you do, you might be changing one and deploying another.


Same problem started occurring after I have upgraded the buildVersion from 23. Tried removing AVDs and recreating, Synching up with Gradle Files. Nothing helped. Complete reinstallation of Andriod Studio has fixed the problem. This may not be the solution but this only worked for me.


Also me solved it by not using the Instant Run feature. Might not be the best solution but it works for now. I'm using Android Studio 2.0 beta 2...


The thing that worked for me was to add some bad xml to one of my layout xml files, try to build and get an error, then revert the change and debug again. Not pretty, but pretty fast.

Another thing that seems to work most of the time: unplug and reconnect your development phone/device. This seems to force a reinstall, at least on my Linux machine.


I Like Instant Run Feature and I don't like to disable it just because of this bug. Not a solution but as a better workaround I'd prefer to:

  1. Press "Recent Apps"
  2. Simply close my app from the list
  3. Run the app again

This takes less time than Clean or Rebuild.

UPDATE

Rerun the app also works:

여기에 이미지 설명 입력


I have the same issue, I unchecked instant Run and also i tried "clean and run option" but its not working. I tried to gradle sync it, but still i had the issue. Its gets resolved only if i rebuild it completely by deleting build folder.


You can understand whether the code is deployed or not by putting a debug breakpoint to the new line that you added. If there is a cross on the breakpoint, this means it is not deployed. You need to clean and rebuild the project.


For Today(31/3/2018) Downgrade Just install Android Studio 3.0.1 Without uninstall Android Studio 3.1.0 it is time saving...for me

1.)Official Download link(android studio 3.0.1 of size 684mb): https://dl.google.com/dl/android/studio/install/3.0.1.0/android-studio-ide-171.4443003-windows.exe

2.)directly start installation without uninstall previous

3.)only allow to replace program files in C:\Program Files\Android\Android Studio\

4.)don't delete previous config files during installation process

because it is time saving to do so and its work instantly for me right now and i tried many option in android srudio 3.1.0 and after given my days to it i get out of this problem

참고URL : https://stackoverflow.com/questions/29312900/android-studio-not-deploying-changes-to-app

반응형