What is minimally required to generate an .apk?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

What is minimally required to generate an .apk?

Phil Dougherty
My situation is that I'm attempting to build a vulkan + openxr app for the Oculus Quest.

I've thus far successfully generated my libmyapp.so making use of android_native_app_glue (along with vulkan and oculus' version of openxr).

I have an AndroidManifest.xml which uses <application ... android:hasCode="false">, and the <activity> tag contains <meta-data android:name="android.app.lib_name" android:value="myapp"/> (along with the other recommendations here: https://developer.android.com/ndk/samples/sample_na , and here https://developer.oculus.com/downloads/package/oculus-openxr-mobile-sdk/  ).

I have a build.gradle file which looks like the following:

android {
  compileSdkVersion 30
  buildToolsVersion "30.0.0"
  project.archivesBaseName = "myapp"
  ndkVersion "21.3.6528147"

  defaultConfig {
    applicationId "com.dophil.myapp"
    minSdkVersion 26
    targetSdkVersion 26
    compileSdkVersion 26
    versionCode 1
    versionName "0.1"
  }

  sourceSets {
    main {
      manifest.srcFile 'AndroidManifest.xml'
    }
  }
}

and can run `gradle build` with success (it even generates an .apk).

However- I'm quite sure that I'm missing at LEAST one step (and likely many), because I haven't made explicit where libmyapp.so exists such that it could package it in the .apk (let alone the other resources libmyapp.so expects to be able to find).

what are my next steps in packaging that library, and other resources it needs, together into a coherent .apk? (If this is too large a question, I would also appreciate being directed to some resource which I could use to help myself!) I would prefer if possible to NOT rely on using android studio to create a new project and porting my existing project structure to that (I already have compiled my NDK-using C++ codebase!).

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/87cb71da-7102-4dae-85b2-eb9376b97aedn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: What is minimally required to generate an .apk?

Dan Albert
Preferably you'd use Gradle to build your C++ code (via CMake or ndk-build, using externalNativeBuild), and then you don't have to do anything else.

If for some reason that's a bad fit for your project (it almost never is for anything but third-party code), you can include your libraries as a prebuilt in your project by putting them in the right directory.


On Wed, Aug 12, 2020 at 3:09 PM Phil Dougherty <[hidden email]> wrote:
My situation is that I'm attempting to build a vulkan + openxr app for the Oculus Quest.

I've thus far successfully generated my libmyapp.so making use of android_native_app_glue (along with vulkan and oculus' version of openxr).

I have an AndroidManifest.xml which uses <application ... android:hasCode="false">, and the <activity> tag contains <meta-data android:name="android.app.lib_name" android:value="myapp"/> (along with the other recommendations here: https://developer.android.com/ndk/samples/sample_na , and here https://developer.oculus.com/downloads/package/oculus-openxr-mobile-sdk/  ).

I have a build.gradle file which looks like the following:

android {
  compileSdkVersion 30
  buildToolsVersion "30.0.0"
  project.archivesBaseName = "myapp"
  ndkVersion "21.3.6528147"

  defaultConfig {
    applicationId "com.dophil.myapp"
    minSdkVersion 26
    targetSdkVersion 26
    compileSdkVersion 26
    versionCode 1
    versionName "0.1"
  }

  sourceSets {
    main {
      manifest.srcFile 'AndroidManifest.xml'
    }
  }
}

and can run `gradle build` with success (it even generates an .apk).

However- I'm quite sure that I'm missing at LEAST one step (and likely many), because I haven't made explicit where libmyapp.so exists such that it could package it in the .apk (let alone the other resources libmyapp.so expects to be able to find).

what are my next steps in packaging that library, and other resources it needs, together into a coherent .apk? (If this is too large a question, I would also appreciate being directed to some resource which I could use to help myself!) I would prefer if possible to NOT rely on using android studio to create a new project and porting my existing project structure to that (I already have compiled my NDK-using C++ codebase!).

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/87cb71da-7102-4dae-85b2-eb9376b97aedn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CAFVaGhva8oWWeLuOgPz6XiwdLO3AvCeFGnYYXOZrFPdmm7k8qQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: What is minimally required to generate an .apk?

Phil Dougherty
ah- brilliant! yes that is _exactly_ the doc I was looking for, but my apparently lackluster google fu convinced me didn't exist. thank you!

On Wednesday, August 12, 2020 at 7:23:30 PM UTC-5 Dan Albert wrote:
Preferably you'd use Gradle to build your C++ code (via CMake or ndk-build, using externalNativeBuild), and then you don't have to do anything else.

If for some reason that's a bad fit for your project (it almost never is for anything but third-party code), you can include your libraries as a prebuilt in your project by putting them in the right directory.


On Wed, Aug 12, 2020 at 3:09 PM Phil Dougherty <[hidden email]> wrote:
My situation is that I'm attempting to build a vulkan + openxr app for the Oculus Quest.

I've thus far successfully generated my libmyapp.so making use of android_native_app_glue (along with vulkan and oculus' version of openxr).

I have an AndroidManifest.xml which uses <application ... android:hasCode="false">, and the <activity> tag contains <meta-data android:name="android.app.lib_name" android:value="myapp"/> (along with the other recommendations here: https://developer.android.com/ndk/samples/sample_na , and here https://developer.oculus.com/downloads/package/oculus-openxr-mobile-sdk/  ).

I have a build.gradle file which looks like the following:

android {
  compileSdkVersion 30
  buildToolsVersion "30.0.0"
  project.archivesBaseName = "myapp"
  ndkVersion "21.3.6528147"

  defaultConfig {
    applicationId "com.dophil.myapp"
    minSdkVersion 26
    targetSdkVersion 26
    compileSdkVersion 26
    versionCode 1
    versionName "0.1"
  }

  sourceSets {
    main {
      manifest.srcFile 'AndroidManifest.xml'
    }
  }
}

and can run `gradle build` with success (it even generates an .apk).

However- I'm quite sure that I'm missing at LEAST one step (and likely many), because I haven't made explicit where libmyapp.so exists such that it could package it in the .apk (let alone the other resources libmyapp.so expects to be able to find).

what are my next steps in packaging that library, and other resources it needs, together into a coherent .apk? (If this is too large a question, I would also appreciate being directed to some resource which I could use to help myself!) I would prefer if possible to NOT rely on using android studio to create a new project and porting my existing project structure to that (I already have compiled my NDK-using C++ codebase!).

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/87cb71da-7102-4dae-85b2-eb9376b97aedn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/acf74ba8-a134-49e0-bf17-b0a387fa11a1n%40googlegroups.com.