1
00:00:00,180 --> 00:00:00,320
Hi.

2
00:00:00,390 --> 00:00:00,990
Hello again.

3
00:00:02,070 --> 00:00:07,200
In the previous video, well, I showed you was how to install VirtualBox, how to install Ubuntu

4
00:00:07,200 --> 00:00:08,140
inside VirtualBox.

5
00:00:08,430 --> 00:00:14,820
And then we transported the files, the project files into this Ubuntu operating system.

6
00:00:15,030 --> 00:00:17,730
So now they are in the file system inside Ubuntu.

7
00:00:18,730 --> 00:00:25,890
What we are going to do now is we are going to use the Buildozer Python library to create an APK

8
00:00:25,920 --> 00:00:26,280
file.

9
00:00:26,640 --> 00:00:33,120
But before we do that, we need to install some dependencies, in that Ubuntu operating system because

10
00:00:33,120 --> 00:00:42,480
because Buildozer needs them to be able to create this APK mobile file. To do that while you

11
00:00:42,480 --> 00:00:45,390
are in the folder where the project files are

12
00:00:46,140 --> 00:00:46,470
right-click

13
00:00:46,500 --> 00:00:49,650
and go to open in terminal.

14
00:00:50,640 --> 00:00:52,950
So that will open the Linux terminal.

15
00:00:53,310 --> 00:00:55,560
You'll see this current directory.

16
00:00:55,950 --> 00:00:58,520
So that is where your files are. If you do ls,

17
00:00:59,280 --> 00:01:01,050
you'll see that these are the files.

18
00:01:01,840 --> 00:01:03,290
So, main.py is there.

19
00:01:03,600 --> 00:01:05,550
Make sure this is named

20
00:01:05,940 --> 00:01:06,630
exactly main.py

21
00:01:06,700 --> 00:01:14,340
because Buildozer needs to see that file and that file should have the main program.

22
00:01:14,880 --> 00:01:17,460
I do need this screenshot file.

23
00:01:17,640 --> 00:01:19,020
So I'm just going to remove that.

24
00:01:25,270 --> 00:01:32,760
So as you can see, the screen shots file, it's not there anymore. 
To locate the open windows on Ubuntu

25
00:01:33,010 --> 00:01:33,910
go to activities,

26
00:01:34,570 --> 00:01:39,040
and so you'll see that the terminal is open and the file explorer is also open as well.

27
00:01:39,370 --> 00:01:40,450
So click on terminal.

28
00:01:40,950 --> 00:01:43,420
That's that will bring back the terminal window.

29
00:01:43,870 --> 00:01:48,820
Now, among those files, you see this kivy-buildozer-installer.sh.

30
00:01:49,330 --> 00:01:53,520
You can see the content of that file using cat.

31
00:01:55,150 --> 00:01:56,740
And write the name of the file.

32
00:01:59,110 --> 00:02:01,400
So this is what that file has inside.

33
00:02:01,680 --> 00:02:07,910
And basically these are instructions on installing many dependencies, including Python, Buildozer

34
00:02:07,990 --> 00:02:12,190
and Kivy, because this Linux system doesn't have Kivy neither.

35
00:02:13,210 --> 00:02:13,540
So.

36
00:02:15,610 --> 00:02:19,560
Go down here we are again here and click bash

37
00:02:20,270 --> 00:02:20,860
ki.

38
00:02:22,130 --> 00:02:24,770
Press tap to autocomplete the name.

39
00:02:25,220 --> 00:02:27,860
So that is the name of the sh file.

40
00:02:28,700 --> 00:02:34,890
Click, enter, enter the password for your Ubuntu system.

41
00:02:34,930 --> 00:02:39,310
So this is a password that you created when you were installing Ubuntu.

42
00:02:39,520 --> 00:02:45,250
Ubuntu asked you for a username and password and expect this to take a while.

43
00:02:45,640 --> 00:02:51,710
And so Ubuntu is now downloading these packages from the Internet and the Internet was automatically

44
00:02:51,710 --> 00:02:54,140
enabled when you installed Ubuntu.

45
00:02:54,140 --> 00:02:59,300
So you didn't have to do any manual configuration of the Internet connection.

46
00:03:00,800 --> 00:03:04,340
Sometimes you'll get some warnings, but you can ignore them.

47
00:03:05,960 --> 00:03:10,760
And this is not a stable process because there's a lot of dependencies involved.

48
00:03:10,790 --> 00:03:17,540
And sometimes you get some errors when we create that APK file so that file will not be created sometimes.

49
00:03:17,540 --> 00:03:21,540
It's not an easy process, but you can read the errors.

50
00:03:21,580 --> 00:03:27,950
What they are saying and maybe search on Google to see what others are talking about, about that particular

51
00:03:27,950 --> 00:03:28,310
error.

52
00:03:28,670 --> 00:03:31,640
So there is no guarantee that it will work.

53
00:03:31,820 --> 00:03:39,700
That being said, Linux is the best operating system to be able to create these APK packages.

54
00:03:39,920 --> 00:03:45,350
And finally, the installation has finished in my computer in my virtual Linux computer.

55
00:03:46,700 --> 00:03:48,020
The next step is optional.

56
00:03:48,050 --> 00:03:56,120
You might want to try out the app that you have. 
To do that use python3, the python3 command.

57
00:03:56,780 --> 00:04:00,920
Main.py which is the file that we have been using.

58
00:04:01,280 --> 00:04:04,640
So the app is working fine with Python.

59
00:04:08,480 --> 00:04:09,670
Let's try it out.

60
00:04:13,960 --> 00:04:14,980
Yeah, it's working fine.

61
00:04:15,610 --> 00:04:17,630
So close that window.

62
00:04:21,650 --> 00:04:27,170
And the next thing we want to do is to create a Buildozer specification file. To do that

63
00:04:27,200 --> 00:04:29,650
we use buildozer,

64
00:04:29,870 --> 00:04:33,830
so the command buildozer init.

65
00:04:36,730 --> 00:04:36,930
OK.

66
00:04:37,300 --> 00:04:41,230
That's created this buildozer.spec file.

67
00:04:41,950 --> 00:04:46,330
You can minimize this window and find that file in file system.

68
00:04:46,810 --> 00:04:48,280
You can ignore this file.

69
00:04:48,460 --> 00:04:49,360
We don't need this.

70
00:04:49,840 --> 00:04:53,920
It was just some notes I was using. So buildozer.spec.

71
00:04:53,950 --> 00:04:58,840
You can double click it and it will open with the text editor app.

72
00:04:59,020 --> 00:05:05,080
So here what we have here is we can change some parameters of the app that we are going to create.

73
00:05:05,470 --> 00:05:06,610
Let's put the title.

74
00:05:06,820 --> 00:05:09,250
How do you feel?

75
00:05:09,940 --> 00:05:13,360
You can choose a name for the package, but don't use spaces there.

76
00:05:13,750 --> 00:05:14,980
I'll just leave it myapp.

77
00:05:15,430 --> 00:05:16,900
And you want to stop here.

78
00:05:17,050 --> 00:05:20,470
What extensions do you want the package to include?

79
00:05:20,770 --> 00:05:22,480
So we have py files.

80
00:05:22,780 --> 00:05:24,400
We have some png files as well.

81
00:05:24,940 --> 00:05:27,940
And we also have Json files.

82
00:05:29,380 --> 00:05:33,550
So this is what we want to be included.

83
00:05:34,930 --> 00:05:36,250
Kv file as well.

84
00:05:37,030 --> 00:05:39,130
But it's already there.

85
00:05:40,780 --> 00:05:42,520
So kv is already there.

86
00:05:43,000 --> 00:05:45,010
And then go further down.

87
00:05:46,090 --> 00:05:48,370
So this is going to be versioned 0.1.

88
00:05:48,940 --> 00:05:50,590
It's our first deployment.

89
00:05:51,130 --> 00:05:52,810
And then you want to stop in here.

90
00:05:53,470 --> 00:05:57,100
So what requirements does your package have?

91
00:05:57,550 --> 00:05:58,720
Well, let's see

92
00:05:58,720 --> 00:05:59,670
what libraries,

93
00:05:59,860 --> 00:06:01,600
what third party libraries

94
00:06:01,630 --> 00:06:05,230
do we have in our main.py file.

95
00:06:06,940 --> 00:06:08,140
So we have the kivy file.

96
00:06:09,670 --> 00:06:12,340
Hoverable is a local file.

97
00:06:12,400 --> 00:06:14,020
It's not a third party library.

98
00:06:14,350 --> 00:06:17,640
This local file is included in the project files.

99
00:06:17,680 --> 00:06:21,940
So you don't have to declare that in the requirements.

100
00:06:22,510 --> 00:06:23,500
And that's all we have.

101
00:06:23,800 --> 00:06:26,350
Json and glob are standard Python libraries.

102
00:06:26,650 --> 00:06:30,400
So they come with Python at random as well.

103
00:06:30,470 --> 00:06:32,110
Random as well, and also Pathlib.

104
00:06:32,350 --> 00:06:39,260
So in the buildozer.spec file, we don't have to add anything else other than python3

105
00:06:39,280 --> 00:06:42,390
and kivy, go down.

106
00:06:42,520 --> 00:06:48,040
Here you want to enable all orientations not only portrayed on the mobile.

107
00:07:03,080 --> 00:07:06,890
That's fine. And this version here should be changed to 8.

108
00:07:14,840 --> 00:07:15,620
And that's all.

109
00:07:15,890 --> 00:07:20,750
Make sure to save the file, so click save or control S, close.

110
00:07:23,830 --> 00:07:25,840
And then go back to the terminal window.

111
00:07:27,210 --> 00:07:35,410
And now what's left to do is we want to run the command that will create hopefully the APK file.

112
00:07:36,120 --> 00:07:41,740
That is buildozer android debug.

113
00:07:50,860 --> 00:07:56,650
At some point, that will ask you if you want to accept the license, to accept the license

114
00:07:56,660 --> 00:07:57,010
press Y

115
00:07:57,190 --> 00:07:57,880
and then enter.

116
00:08:04,250 --> 00:08:06,440
That's initially failed in my system.

117
00:08:06,710 --> 00:08:13,280
So if that is the case, you might want to go back and look at the error because these are just generic

118
00:08:13,550 --> 00:08:14,300
messages.

119
00:08:16,790 --> 00:08:20,400
You want to locate after these colours,

120
00:08:21,290 --> 00:08:23,270
you want to locate here

121
00:08:23,440 --> 00:08:25,460
the top of the red message.

122
00:08:27,420 --> 00:08:32,640
So that command failed, and I think that is because we specified version eight.

123
00:08:33,720 --> 00:08:37,710
So let's try to go to the buildozer.spec file.

124
00:08:38,920 --> 00:08:40,240
And change that.

125
00:08:49,080 --> 00:08:50,440
Delete that value.

126
00:08:51,710 --> 00:08:56,810
And replace it with arm64-v8a. Paste that in there.

127
00:08:57,330 --> 00:09:02,570
And besides this, we also I think we forgot to

128
00:09:05,480 --> 00:09:08,990
add the .txt extension.

129
00:09:09,440 --> 00:09:12,750
Among the accepted extensions here.

130
00:09:13,040 --> 00:09:15,800
So .txt because .txt

131
00:09:18,460 --> 00:09:20,410
is the file where we have those quotes.

132
00:09:21,220 --> 00:09:31,300
So make sure to save this, close it and go to that terminal again, this time we're going to try again

133
00:09:31,330 --> 00:09:35,140
to build the APK file using buildozer android.

134
00:09:35,470 --> 00:09:39,690
But this time, we're going to have the clean flag and then debug.

135
00:09:40,270 --> 00:09:48,430
So the clean flag will make sure not to mess with the previous efforts of trying to build the APK package.

136
00:09:49,040 --> 00:09:49,480
Press enter

137
00:09:49,750 --> 00:09:56,140
and again, we are going to have to wait a while for the process of packaging to be completed.

138
00:09:56,500 --> 00:10:00,850
But this time you're not going to be asked to accept the license.

139
00:10:01,240 --> 00:10:04,120
The process might be quicker than before.

140
00:10:04,780 --> 00:10:05,590
So let's wait a bit.

141
00:10:06,130 --> 00:10:09,880
So the second build efforts were completed in my Linux.

142
00:10:10,280 --> 00:10:12,100
Go to the folder.

143
00:10:12,460 --> 00:10:14,610
Bin has been created in the folder.

144
00:10:16,090 --> 00:10:19,660
So inside that you should be able to find the APK file.

145
00:10:20,470 --> 00:10:22,450
So that's about this video. In the next video

146
00:10:22,480 --> 00:10:26,040
I'm going to get an Android device and I'm going to show you how to install

147
00:10:26,110 --> 00:10:28,550
that APK file on an Android device.

148
00:10:28,850 --> 00:10:29,110
See you.

