TL;DR
After adding url_launcher
to my pubspec
I cannot startup my application in Android anymore. On start I get the following output in Logcat: Didn't find class "$prefix.$projectname.MainActivity" on path: DexPathList[[zip file "/data/app/...
, where $prefix.$projectname
is not the correct package because I changed it to $prefix.$name
, where name
is some other string.
My application starts fine once I remove url_launcher
again.
Comprehensive
When only adding url_launcher
to my pubspec.yaml
file my application becomes unable to start on Android. I do not even have to use any of it in my code.
After some further investigation I found a log message in Logcat for Android: Didn't find class "$prefix.$projectname.MainActivity" on path: DexPathList[[zip file "/data/app/...
. And this is the origin of the error!
I changed my package name after creating the project because Flutter is still buggy :) In the creation wizard I typed $prefix.$name
(these are just variables; prefix
is always the same and the other two as well; for reference look at the error message, where I inserted it as well. On my first build the package name turned out to be $packagename.$projectname
then. I found a workaround for that: Changing the code directory name in the Android src
directory and changing applicationId
name in build.gradle
.
So now my package name is $prefix.$name
. My Android Studio project name/folder is still projectname
though. Without url_launcher
in my pubspec
everything works fine, but when adding it a directory gets created like this:
Without url_launcher
:
project/build/app:
-generated
-intermediates
-outputs
-tmp
After adding url_launcher
another directory (besides app
) suddenly appears in the build
directory:
project/build/app:
-generated
-intermediates
-outputs
-tmp
project/build/url_launcher:
-generated
-intermediates
-outputs
-tmp
The url_launcher
directory in the build
directory has the same sub-directories as the app
directory. I am just mentioning this because I am unsure whether this is unwanted behavior or not.