1

I'm working on an Android Things robot.

I have a pretty big apk file because I'm including dlib face recognition libraries.
89.0Mb

When uploading my code it takes about 20 minutes every time.
This obviously slows down development significantly.

Some Additional information:
With android things I connect to the device with adb over wifi.
Then it does a split install.
The next time it runs it will just upload the slices that changed.
This speeds it up to a few minutes, however, about 50% of the time though is looses its connection somehow and I have to upload the whole thing again.

current version: 0.2-devpreview

adb install-multiple -r /home/nburn42/maki-things/app/build/intermediates/split-apk/debug/slices/slice_9.apk /home/nburn42/maki-things/app/build/intermediates/split-apk/debug/slices/slice_0.apk /home/nburn42/maki-things/app/build/intermediates/split-apk/debug/slices/slice_4.apk /home/nburn42/maki-things/app/build/intermediates/split-apk/debug/slices/slice_7.apk /home/nburn42/maki-things/app/build/intermediates/split-apk/debug/slices/slice_2.apk /home/nburn42/maki-things/app/build/outputs/apk/app-debug.apk /home/nburn42/maki-things/app/build/intermediates/split-apk/debug/slices/slice_3.apk /home/nburn42/maki-things/app/build/intermediates/split-apk/debug/slices/slice_6.apk /home/nburn42/maki-things/app/build/intermediates/split-apk/debug/slices/slice_1.apk /home/nburn42/maki-things/app/build/intermediates/split-apk/debug/dep/dependencies.apk /home/nburn42/maki-things/app/build/intermediates/split-apk/debug/slices/slice_8.apk /home/nburn42/maki-things/app/build/intermediates/split-apk/debug/slices/slice_5.apk

Is the problem with:
A - My apk size - Edit (90MB transfered over the network should be much faster)
B - My internet connection - Edit (Not the problem)
C - Android Things itself
D - Something else?

Thanks a ton,
Nathan

nburn42
  • 697
  • 7
  • 25

2 Answers2

3

Add this in your build.gradle(module:app) file,

    buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

This will decrease your apk size by excluding unused libraries & code.

Ashish Gupta
  • 737
  • 11
  • 18
  • Thanks for the suggestion. I did a bit more coding, then tried this, then checked the apk size. It seems that it didn't do much, its now at 90.9Mb. – nburn42 Apr 15 '17 at 08:52
  • 1
    I unzipped my apk. shape_predictor_68_face_landmarks.dat in my assets folder is 99Mb but got compressed down some. I guess this means that 90Mb is just an unreasonable size for an apk? Maybe I should figure out how to get that file over there besides the asset folder. – nburn42 Apr 15 '17 at 09:04
0

I'd say the problem is on your WiFi, you can easily make a calculation that 80Mb should take no more than 2 minutes in a normal WiFi, but if the signal is bad or there are interferences it can slow down significantly. I suggest you consider using a wired network.

Also, compilation, dexing and packaging can take a while. Are you sure your 20 minutes are just uploading the apk?

shalafi
  • 3,926
  • 2
  • 23
  • 27
  • I have been debugging this a bit. I tried on a different gigabit network with the raspberry pi plugged into Ethernet. It didn't speed it up. – nburn42 Apr 16 '17 at 22:40
  • I also tried turning off instant run. The command that takes forever is the command where it has the path to my local APK and the temp folder on the pi. The next command does the install from the temp folder and that takes tens of seconds. I think that means that copying the apks over does something other than just copying that takes a long time. – nburn42 Apr 16 '17 at 22:57