fix android build
This commit is contained in:
parent
b9384bdada
commit
aa2fd671eb
2 changed files with 15 additions and 4 deletions
|
@ -5,6 +5,7 @@ buildscript {
|
|||
dependencies {
|
||||
def nav_version = "2.5.1"
|
||||
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
|
||||
classpath "com.android.tools.lint:lint-gradle:30.2.2"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,6 +40,11 @@ android {
|
|||
buildFeatures {
|
||||
viewBinding true
|
||||
}
|
||||
packagingOptions {
|
||||
exclude '/META-INF/AL2.0'
|
||||
exclude '/META-INF/LGPL2.1'
|
||||
exclude '/com/sun/jna/**'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -76,4 +82,8 @@ dependencies {
|
|||
implementation "androidx.camera:camera-view:1.1.0"
|
||||
|
||||
implementation 'org.osmdroid:osmdroid-android:6.1.13'
|
||||
|
||||
// workaround for gradle being terrible
|
||||
compileOnly "com.android.tools.build:aapt2:7.2.2-7984345"
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
});
|
||||
androidSdk = android-nixpkgs.sdk.${system} (sdkPkgs: with sdkPkgs; [
|
||||
build-tools-30-0-3
|
||||
build-tools-33-0-0
|
||||
cmdline-tools-latest
|
||||
platform-tools
|
||||
platforms-android-33
|
||||
|
@ -49,7 +50,7 @@
|
|||
texlive-env
|
||||
];
|
||||
# override the aapt2 that gradle uses with the nix-shipped version
|
||||
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/libexec/android-sdk/build-tools/32.0.0/aapt2";
|
||||
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/share/android-sdk/build-tools/33.0.0/aapt2";
|
||||
};
|
||||
packages = rec {
|
||||
invtracker-deps = pkgs.stdenv.mkDerivation {
|
||||
|
@ -63,13 +64,13 @@
|
|||
gradle --no-daemon --info -Dorg.gradle.java.home=${pkgs.openjdk_headless} --write-verification-metadata sha256
|
||||
'';
|
||||
installPhase = ''
|
||||
find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(aar\|jar\|pom\)$' \
|
||||
find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(aar\|jar\|pom\|module\)$' \
|
||||
| perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/maven/$x/$3/$4/$5" #e' \
|
||||
| sh
|
||||
'';
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "sha256-qvi92U7yxA9p3uwo+rd83QxDqwsdff7vcOQbxte/23U=";
|
||||
outputHash = "sha256-jMHui3QkYQhMHkxIzXuol4Vl/fCHsbtOrzTJBMQNb0Y=";
|
||||
};
|
||||
invtracker-server = pkgs.stdenv.mkDerivation {
|
||||
pname = "invtracker-server";
|
||||
|
@ -98,7 +99,7 @@
|
|||
sed -i 's#google..#maven { url "${invtracker-deps}/maven" }#' settings.gradle
|
||||
|
||||
export GRADLE_USER_HOME=$(mktemp -d)
|
||||
gradle --offline --no-daemon --info -Dorg.gradle.java.home=${pkgs.openjdk_headless} app:build
|
||||
gradle --offline --no-daemon --info -Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/share/android-sdk/build-tools/33.0.0/aapt2 -Dorg.gradle.java.home=${pkgs.openjdk_headless} app:build
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
|
|
Loading…
Reference in a new issue