[Android] Kotlin + Dagger2: Unresolved reference AppComponent when generating signed APK

I was having this error when deploying a signed APK of my App, running and debugging were both working fine.
After two hours fighting this issue, this was the solution

app/build.gradle


kapt {
generateStubs = true
}

dependencies {
....
}

I placed the “kapt” block before the “dependencies” one and after “android”. Now I can deploy signed APKs

Advertisement

[Ubuntu] Adding a folder to your path permantently

After various incorrect SO answers, I’ve found the right solution for ubuntu 16.04 LTS.

cd ~
cat .profile

edit .profile file and add these lines

PATH=$PATH:/home/user/android-sdk/platform-tools:/home/user/java/jdk1.8.0_121/bin
export JAVA_HOME=/home/user/java/jdk1.8.0_121
export STUDIO_JDK=$JAVA_HOME
export JDK_HOME=$JAVA_HOME

Then Ctrl+X and save

After rebooting my machine (closing the terminal didn’t work, I don’t know if closing session will be enough, but anyway my machine boots in 15 seconds so rebooting is quite fast :P) I can work with the new path. To check it:

java -version

should return the correct version of Java installed

[Git] Adding your key to Bitbucket

When using our Bitbucket origin from a new computer, we will usually find this message:

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

That’s normal. Bitbucket does not trust our computer yet, we have to add its key to the list of trusted hosts.

If you already have a SSH key, copy it and add it to bitbucket.

First, to copy it, open a terminal and write the following

cd ~/.ssh/
cat id_rsa.pub

Then you will find something like this*

ssh-rsa AAAB3NzaC1yc2EAAAADAQABAAABAQDGf57XkGtFONIn5fskaF1/6obxgLUq3r+lnyUkBJP6qIOyJ+0K[…]OdecdoOL8hQZagq+ff3X23GwfvJPj1Ytf your.mail@company.com

Copy this key in your clipboard, then log in into Bitbucket and do the following:

1.- Click on the user account icon (in the top-right of the screen)
2.- Then on “Bitbucket Settings”
3.- Now, under “Security”, click on “SSH Keys”
4.- Click on “Add key”
5.- Now assign a name to your key (e.g.: “My Laptop key”) and paste your clipboard inside the “Key” field. Click on “Add key”.

* If there is no id_rsa.pub or any .pub files, go to “Generating a new SSH key” section

Generating a new SSH key

In order to generate a new SSH key, write the following

ssh-keygen -t rsa -C “your_mail@company.com”

Generating public/private rsa key pair.

Enter file in which to save the key (/home/olmo/.ssh/id_rsa): mykey

Enter passphrase (empty for no passphrase): passphrase
Enter same passphrase again: passphrase

Your identification has been saved in mykey.
Your public key has been saved in mykey.pub.