gpt4 book ai didi

java - 如何在 Spring Boot 应用程序中读取和存储 apk 元数据

转载 作者:行者123 更新时间:2023-12-02 01:32:13 24 4
gpt4 key购买 nike

我们正在开发 Android 商店。它是一个基于 Spring 的后端原型(prototype),对于客户端,我们使用开源项目 Aurora:https://gitlab.com/AuroraOSS/AuroraStore

我们必须在 Nexus 中存储有关我们上传的 apk 的一些信息。我们的第一个问题是如何在 Spring 应用程序中读取 AndroidManifest.xml?有没有可用的maven模块?

第二个问题是我们如何管理数据库中的 Android 信息?例如,我们在 Android Studio 下有通常用于 Java Android 项目的 PackageInfo。但我们必须为应用程序存储这些信息吗?我们怎么能点它呢?

package android.content.pm;

import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import androidx.annotation.RecentlyNonNull;

public class PackageInfo implements Parcelable {
@RecentlyNonNull
public static final Creator<PackageInfo> CREATOR = null;
public static final int INSTALL_LOCATION_AUTO = 0;
public static final int INSTALL_LOCATION_INTERNAL_ONLY = 1;
public static final int INSTALL_LOCATION_PREFER_EXTERNAL = 2;
public static final int REQUESTED_PERMISSION_GRANTED = 2;
public ActivityInfo[] activities;
public ApplicationInfo applicationInfo;
public int baseRevisionCode;
public ConfigurationInfo[] configPreferences;
public FeatureGroupInfo[] featureGroups;
public long firstInstallTime;
public int[] gids;
public int installLocation = 1;
public InstrumentationInfo[] instrumentation;
public boolean isApex;
public long lastUpdateTime;
public String packageName;
public PermissionInfo[] permissions;
public ProviderInfo[] providers;
public ActivityInfo[] receivers;
public FeatureInfo[] reqFeatures;
public String[] requestedPermissions;
public int[] requestedPermissionsFlags;
public ServiceInfo[] services;
public String sharedUserId;
public int sharedUserLabel;
/** @deprecated */
@Deprecated
public Signature[] signatures;
public SigningInfo signingInfo;
public String[] splitNames;
public int[] splitRevisionCodes;
/** @deprecated */
@Deprecated
public int versionCode;
public String versionName;

public PackageInfo() {
throw new RuntimeException("Stub!");
}

public long getLongVersionCode() {
throw new RuntimeException("Stub!");
}

public void setLongVersionCode(long longVersionCode) {
throw new RuntimeException("Stub!");
}

public String toString() {
throw new RuntimeException("Stub!");
}

public int describeContents() {
throw new RuntimeException("Stub!");
}

public void writeToParcel(Parcel dest, int parcelableFlags) {
throw new RuntimeException("Stub!");
}
}

提前致谢。

编辑:为了读取 apk 元数据,我们找到了这个模块: https://github.com/hsiafan/apk-parser

<dependency>
<groupId>net.dongliu</groupId>
<artifactId>apk-parser</artifactId>
<version>2.6.9</version>
</dependency>

最佳答案

我们找到了这个插件https://github.com/hsiafan/apk-parser解析信息。

<dependency>
<groupId>net.dongliu</groupId>
<artifactId>apk-parser</artifactId>
<version>2.6.9</version>
</dependency>

然后根据提供的文档,我们检索所有信息并保存在数据库中

关于java - 如何在 Spring Boot 应用程序中读取和存储 apk 元数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57549033/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com