Android Studio - Deploys my app without new changes

左心房为你撑大大i 提交于 2019-12-24 11:24:04

问题


My problem is basically that Android Studio wont deploy my app with my changes in the new code. Heres my case scenario:

I have a wifi direct code working like this (just testing with its methods):

    public void peerDiscovery(){

    mWifiDirectManager.discoverPeers(mChannel,

      new WifiP2pManager.ActionListener() {
        @Override
        public void onSuccess() {
             Log.v(TAG,"Discovery Peers Success");


        }

        @Override
        public void onFailure(int reason) {
            Log.e(TAG,"Error on Discovery Peers, code: "+reason);


        }
     });
}

The above code works and then I decided to change it by adding the method: setPeerDiscoveryHandler(boolean isSuccess);

After the changes my code was as follows:

 public void peerDiscovery(){

    mWifiDirectManager.discoverPeers(mChannel,
      new WifiP2pManager.ActionListener() {
        @Override
        public void onSuccess() {
            setPeerDiscoveryHandler(true);
            Log.v(TAG, "Message Sent");
        }

        @Override
        public void onFailure(int reason) {
            Log.e(TAG,"Error on Discovery Peers, code: "+reason);
            setPeerDiscoveryHandler(false);
        }
    });
}

But guess what, even after doing this new code and clicking on the Run button, it was like I didnt do nothing! And I realized that was happening after I started to check my logcat and the message:

"Discovery Peers Success"

was being printed, but I had it removed from the code (as you can see in my new code). I tried to rebuild and clean the project, uninstall the application from the mobile before deploying it again, but nothing seems to take effect. Any thoughts about it ?

Thanks in advance for all help guyz.


回答1:


Well guyz, turns out that I found the solution for that problem of mine. Actually, I dont know why, but when that starts to happen you need to click on a button called "Sync Project with Gradle Files", and it will sync all your project files all over again. Like I said before, I really dont understand why that is needed, but in case someone have this problem in the future thats a solution. Thanks.



来源:https://stackoverflow.com/questions/28183822/android-studio-deploys-my-app-without-new-changes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!