Hello, I'm pretty new to jenkins, my ultimate goal is to automatize our building process via jenkins. We develop android games in Unity3D and looking for a faster way to build and distribute apk's within the company(locally) & without disturbing the focus of the developers. For this, I thought jenkins suits us just fine.
However I could not seem to be able to build an apk file with jenkins. The error is as follows:
There are a lot more of this AAPT lines but I've only put these for ease of reading. I did some research, there were not a lot of people experienced this issue with Unity but rather with android. Some of the suggestions as follows:
- The path is too long so it couldn't be opened. I tried to change the user.home Environment Variable to something shorter, but it still gave same errors with same paths. Note that I restarted jenkins before taking the build after I set user.home. Also note that these files were created at the path that I've assigned, but it seems that they are not used somehow.
- add android.enableBuildCache=false to gradle.properties. I didn't want to do that, since android recommends build cache to be enabled since it reduces build time, also I don't want to mingle with gradle files in unity, we are using the default one which was provided by Unity.
- The files are actually somehow jpgs, or files are corrupted. I selected some of them and opened the files randomly, they all were successfully opened.
From this part, I'm going to explain what I've tried so far.
I've tried this with 2 different windows PC's. But the result is the same. On the first one:
- I've successfully integrated jenkins with our gitlab repo.
- I used unity3d build plugin
On the second one:
- I directly gave command line arguments to local repo without integrating gitlab.
- I've tested both with unity3d build plugin and Execute windows batch command.
I've configured unity3d build plugin as suggested in it's page and used this command line arguments:
Then I wanted to try my Editor Script without Jenkins:
- First I put a MenuItem attribute so I could start it within Unity Editor, the apk has been successfully built.
- Then I tried to do it with command line, my command line was like this:
It successfully built again.
Lastly, I tried to use command line in jenkins, so Instead of using unity3d-plugin I used Execute Windows batch command in Build tab on the job config. The command was the same that I've previously used directly in command line, same error again.
Now to sum up, I've tested this on 2 different Windows PC's and both of them were worked without Jenkins(Both Unity Editor and in Command Line) but with Jenkins, I received the aforementioned error. My last resort was to write here and explain the situation, hoping to find a solution or a fix. I'm happy to provide more information if the explanation is too vague or deficient.