1

I am porting my app to Android Studio and came across this problem that the version code that the APK is being detected (when uploading to Google Play) is 1 from the Manifest file of the library project (circularImageView). My actual app is named app below.

enter image description here

When I try to upload the app to Google Play, it says that my versionCode = 1 (see screenshot below): enter image description here

See below for the versionCode in actually my app which is 58. enter image description here

user1406716
  • 9,565
  • 22
  • 96
  • 151
  • It's not possible. Android studio always get version from your project `build.gradle` file – M D Jun 04 '15 at 08:57
  • aah I see, so I need to change the versionCode in build.gradle also. Let me try that quick but you are right i think too. WIll report back in a few minutes, add your comment as answer and I will mark it as answer once i get it working. I am just coming from Eclipse so getting used to the gradle stuff. – user1406716 Jun 04 '15 at 08:58

2 Answers2

4

Android studio always get version from your project build.gradle file

See the below snap: in Android Studio build.gradle

enter image description here

M D
  • 47,665
  • 9
  • 93
  • 114
  • 1
    wont let me mark as answer for another 9mins, too late here .. will do this in the morning. – user1406716 Jun 04 '15 at 09:03
  • @user1406716 Ok don't worry. but is your problem solved? – M D Jun 04 '15 at 09:03
  • yes, just havent been familiar with Android Studio so had this confusion. So should I updating version number in Manifest **AND** `build.gradle` every time it needs to be incremented or does the Manifest does not matter at all? – user1406716 Jun 04 '15 at 09:05
  • Delete the values in manifest to avoid confusion, they are overriden by those in build.gradle. – Eugen Pechanec Jun 04 '15 at 09:06
  • @user1406716 here in Android Studio `manifest.xml` used only for registering your activities, permissions and components etc... and `build.gradle` used for `apk` built control `(flavors, variants, etc)` seprately. – M D Jun 04 '15 at 09:08
0

Change Code version in build.gradle of your app. Android studio combine Manifest at run. I think if you don't mention codeVersion in build.gradle then it pick version from Manifest generated after combining of all projects.

Ahmad Nawaz
  • 1,129
  • 7
  • 26