uni-app offline packages the .jks certificate created in android studio, but the signature file cannot obtain MD5.

uni-app offline packaging—the .jks signature file created in android studio cannot obtain MD5.

One of the problems encountered during the first development (problems encountered in developing uni-app)

Project description:
项目是一个比较老的项目,然后又是第一次做uni-app,因为官网给出云打包和离线打包方式,当时走的云打包,发现要排队,大概要10几分钟,最后提示我打包成功了,但是我没找到对应apk文件,让我一度怀疑人生,后面我重新建了一个新项目,然后云打包成功,我很是怀疑项目太老了,最后没办法我只能离线打包;


Problem Description

离线打包的证书:

After I generate local packaged offline resources through Hbuilder, I then follow a series of operations to download the official offline sdk, and then replace the folder corresponding to the corresponding appid. In fact, according to the official public certificate configuration, there is no problem in android studio, but it is public After all, it is for public use. Later, I learned online that you can actually create the certificate yourself on Android Studio.
The steps are as follows:

Insert image description here
Then you get to this interface.
Insert image description here
Click next.
Insert image description here
I already have one here. You can click to create a new one.

Insert image description here

This is very familiar. The first line is to select the path of the jks file generated by the signature. After clicking on the last folder, you will be asked to fill in the jks file name, followed by some passwords that everyone needs to fill in, which will be used 记住这里的两个密码(可以一样的)、别名(我这里是demo)、文件名(我这里是demo.jks)一定要记住later
Insert image description here
. After all this, the jks we just created will come out.
Next, we need the data in this jks!
How to check the certificate? Go directly to the java environment here, which will be used later. I use jdk1.8.
Here is the official recommendation: This is the address .

Insert image description here
After successfully installing the java environment, we can find the bin folder under the jre, enter cmd directly in the address bar, and the command prompt will pop up. However, I recommend adding it directly
Insert image description here
to the system environment variables as the global environment, so that you can Type the keytool command in the terminal
Insert image description here

Okay, let’s get to the point and check out the three signatures sha1, sha256 and MD5 we need in jks.

keytool -list -v -keystore test.keystore  
Enter keystore password: //输入密码,回车

After typing, I felt very uncomfortable as shown in the picture, because it was my first time to do something related to the app. I also found a URL on the Internet that can generate MD5 online, but I want to give a reward. Hey, we are not used to it 没有md5.
Insert image description here
It was a free prostitution, and the follow-up was a long Baidu process. In the middle, I asked my Android colleague, and he gave me a direct operation and said that MD5 can be generated directly. I saw that after some operations, there was MD5 (later I found out that it was wrong). ), they have the sha1 signature algorithm here. Of course, I later found what I thought was an online MD5 generation URL like https://md5file.com, but I found that the generated MD5 was not in the format I wanted. Let’s Let me show you
the following is the uni-app cloud certificate, which means that our certificate needs to generate an offline appkey. Why is this needed? Because it will be used later ( 没这个或者配置的不对,打包后的apk打开后会告诉你appkey配置错误), you must know these three signatures. You
Insert image description here
can see that these three signatures are there. Colon:::::::::: , (ÒωÓױ)!
What was even more outrageous was that I was still thinking about converting the MD5 obtained through the website through other methods. I started Baidu again, and suddenly I seemed to see an article saying that MD5 was generated based on other signature sha1, and then I'm not very clear about encryption and decryption. If anyone knows, please tell me. I'll set up a bench and listen. Anyway, these websites and some other script commands
recommended on the Internet are all wrong. Finally, after searching around, I tried all the methods one by one and only the following one came into use. I knew there was no problem:

Let's take a memory trip back to where I generated demo.jks

solve:

Put the generated jks file in the project package folder, as shown in the picture.
Insert image description here
Open the terminal directly in Android studio,
as shown in the picture
Insert image description here
. Enter the command in my picture.
If an error is reported, it means that you have not installed the java environment or there is a problem with the installation.
Check the java environment.

java -version

Enter the following command to obtain 3 signatures

./gradlew signingReport

Then wait for it to be generated, and that's it.
Insert image description here
When this appears, I know that I am OK again.
The next step is to generate the signed appkey when throwing these three signatures into the uni-app application development center!
Insert image description here
In addition to these, the package name issue is something that needs to be paid attention to 包名必须和项目在Android studio里头的包名一致.
If you want to change the following two pictures, you must change them:
Insert image description here
Insert image description here
After doing this, generate the appkey, which will be used in subsequent modifications to the configuration.
Insert image description here

The next step is to change the packaging and configuration files of android studio,
mainly these three files
. The first one:
Insert image description here
the second one:
Insert image description here
the third one is the most important:
Insert image description here
if you don’t remember, go back and have a look. If you finally package it into an apk, it will be fine. Problem!

I will record the process of developing uni-app for the first time. Maybe I will try the app again one day.
Finally, if there is anything wrong, I welcome you to correct me.
Finally, when you develop uni-app in the future, Did you guys encounter any pitfalls that would save me a few years of detours? I’m tired.

Guess you like

Origin blog.csdn.net/Ysmooth_Alone/article/details/130176427