问题
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