question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problems with building APK

See original GitHub issue

Hi, I wanted to update my local repository to - after long absence - continue working on the app (possibly trying to introduce a non-goolge-option … https://github.com/owntracks/android/pull/239). The new repository layout however seems to be a bit complicated? Maybe I did something wrong? There seem to be other people having trouble with it (https://github.com/owntracks/android/issues/386#issuecomment-240570715) so I open this issue.

I did a fresh clone in Android Studio 2.1 on Linux Mint, but afterwards, the IDE showed not much content. 😃 So i manually opened the sub-folder ‘project’ as a new project window, which then complained about

Error:Could not load wrapper properties from ‘[…]project/gradle/wrapper/gradle-wrapper.properties’. No value with key ‘distributionUrl’ specified in wrapper properties file ‘[…]/project/gradle/wrapper/gradle-wrapper.properties’.

So I copied the old gradle-wrapper.properties file, which had the following content:

#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

After Syncing the Project (Tool Window “Gradle”->“Refresh all Gradle Projects”), the files showed up correctly, i clicked “Run” to compile and deploy a debug version to my device connected via USB. It failed, because of

Error:(17, 33) error: package org.antlr.v4.runtime.misc does not exist and subsequent Error:(278, 44) error: cannot find symbol class NotNull

So I added compile 'org.antlr:antlr4-runtime:4.5.3'

to the “dependencies” section in project/app/build.gradle, synced the project again and did “Run” which finally worked! (although the first start took some time)

I explained my steps here very detailed, in case someone has the same kind of problems. I could also do a pull request for the latter two changes, if you are interested? The first problem (empty project when using the repository root) is not solved by that, though, and I have no idea how to fix that. All those Gradle-wrapper, properties, idea-files make me kind of nervous…

Also, there is another problem: I can’t get to build a final .apk via the Build->Build APK command. It always fails because of

Error⚠️ Ignoring InnerClasses attribute for an anonymous inner class Error:(org.eclipse.paho.client.mqttv3.MqttAsyncClient$1) that doesn’t come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any “-target” type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is not an inner class.

There is an upstream Issue filed: https://github.com/eclipse/paho.mqtt.android/issues/79 but it seems it may take a while until the new version gets released. I tried hours to apply multiple remedys I found on the Internet (Stack Overflow and such) to make the Builder ignore those warnings, but nothing helped. I tried adding

    lintOptions {
        abortOnError false
        checkReleaseBuilds false
    }

into the “android” section in project/app/build.gradle or adding a project.properties with proguard.config=proguard-project.txt and copying the old proguard-project.txt in or adding a proguard-rules.pro with

-keepattributes EnclosingMethod
-keepattributes InnerClasses
-dontoptimize

but nothing helped 😦 I’m a bit lost between all those dotfiles and conventions… it seems, the build process is not using any of them.

So, I managed to copy the installed debug apk from my phone to my own F-Droid repository. In case any of you would like to test a current version (latest repo), add https://fdroid.denk-nach-mcfly.de as a new repository to your F-Droid App. I cannot promise to keep it always up to date there, but if any of you is using it and tells about it here, it will raise my motivation 😉 and I will try to deploy new packages once in a while. Also remember: The repo is not yet authorized by the maintainers ( @binarybucks ), it is not an official repo, the app might be in an unstable state currently! But, since it uses a different id (org.owntracks.debug), it should be installable in parallel to the official app from the play store. I hope, it is OK with you @binarybucks and @jpmens ? I set up the repo mainly for myself in the first place, for debugging purposes, but if it might help somebody, I thought why not share? I don’t want to be rude or offend anybody with providing this alternative source!

Cheers!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
friesenkiwicommented, Aug 22, 2016

Well, it is working now for me, I only thought, it might be good for other people to know… 😉 I was used to clone a project directly from a git repo (File->New->Project from Version control->Git). In this case, you need to make another step and open the project “a second time”. But never mind.

0reactions
binarybuckscommented, Aug 22, 2016

Are you trying to open the actual git root in Android Studio or the project/ dir? The later works fine for me and is how it should work. Opening the root should not and will not work because it just contains the readme and changelog.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Known issues with Android Studio and Android Gradle Plugin
Find out about current known issues with Android Studio and the Android Gradle ... When you navigate to Build > Generate Signed Bundle...
Read more >
what is the problem in build .apk file in flutter in this case?
To generate an app bundle, run: flutter build appbundle --target-platform android-arm,android-arm64 Learn more on: https://developer.android. ...
Read more >
Problem in installing build apk on devices #64536 - GitHub
installed the apk on device and the app freezes on splash screen or not working when screen changed. Tried every possible solutions available....
Read more >
Unable to build apk! - MIT App Inventor Community
It's been 1h I'm looking for a solution for my problem : I can't build my apk file and I don't know why...
Read more >
APK building problem - Unity Answers
How did it crash? You say you created the apk put in on the phone and crashed when downloading? Downloading what? Does this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found