Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent - xamarin.forms

I am getting the below error for my xamarin forms application on version 31 and above.
com.mycompanyname.myappname: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
[ImeFocusController] onWindowFocus: DecorView#74e918a[MainActivity] softInputMode=STATE_UNSPECIFIED|ADJUST_RESIZE|IS_FORWARD_NAVIGATION
[ImeFocusController] Restarting due to isRestartOnNextWindowFocus as true
[ImeFocusController] onViewFocusChanged, view=DecorView#74e918a[MainActivity], mServedView=null
[ImeFocusController] checkFocus: view=null next=DecorView#74e918a[MainActivity] force=true package=
The thread 0xb has exited with code 0 (0x0).
[AndroidRuntime] FATAL EXCEPTION: pool-2-thread-1
[AndroidRuntime] Process: com.mycompanyname.myappname, PID: 7466
[AndroidRuntime] java.lang.IllegalArgumentException: com.mycompanyname.myappname: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
[AndroidRuntime] Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
[AndroidRuntime] at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
[AndroidRuntime] at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
[AndroidRuntime] at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
[AndroidRuntime] at com.google.firebase.iid.zzl.zzd(Unknown Source:18)
[AndroidRuntime] at com.google.firebase.iid.zzl.zzb(Unknown Source:229)
[AndroidRuntime] at com.google.firebase.iid.zzl.zza(Unknown Source:0)
[AndroidRuntime] at com.google.firebase.iid.zzj.zzb(Unknown Source:41)
[AndroidRuntime] at com.google.firebase.iid.zzj.getToken(Unknown Source:56)
[AndroidRuntime] at com.google.firebase.iid.FirebaseInstanceId.getToken(Unknown Source:10)
[AndroidRuntime] at com.google.firebase.iid.FirebaseInstanceId.zzcfy(Unknown Source:4)
[AndroidRuntime] at com.google.firebase.iid.FirebaseInstanceIdService.zza(Unknown Source:148)
[AndroidRuntime] at com.google.firebase.iid.FirebaseInstanceIdService.handleIntent(Unknown Source:122)
[AndroidRuntime] at com.google.firebase.iid.zzc.run(Unknown Source:4)
[AndroidRuntime] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
[AndroidRuntime] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
[AndroidRuntime] at java.lang.Thread.run(Thread.java:920)
Thread started: #12
Java.Lang.IllegalArgumentException: 'com.mycompanyname.myappname: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.'
I am using pendingIntent on my project for FCM.
var intent = new Intent(this, typeof(MainActivity));
intent.AddFlags(ActivityFlags.ClearTop);
var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.OneShot);
I tried FLAG_IMMUTABLE and FLAG_MUTABLE instead of OneShot, but app is breaking. I commented the entire code related to FCM, but after that also, the app is breaking with the same issue.
I tried updating the FCM related Packages, that also don't work. Any other olutions?

You can recheck your problem by following steps as follows:
1.try to update all your firebase libraries and google libraries to the latest;
2.try to add PendingIntent.FLAG_IMMUTABLE to your pending intents.
Here is an example :
var intent = new Intent(this,typeof(MainActivity));
var pendingIntentFlags = (Build.VERSION.SdkInt >= BuildVersionCodes.S)
? PendingIntentFlags.UpdateCurrent | PendingIntentFlags.Mutable
: PendingIntentFlags.UpdateCurrent;
var pendingActivityIntent = PendingIntent.GetActivity(Application.Context, requestCode, intent, pendingIntentFlags);
For more information, you can check this link: PendingIntent#FLAG_IMMUTABLE
3.check if you have installed the latest nuget Xamarin.AndroidX.work.runtime;

Related

Beryx Badass Runtime TLSv1.3 javax.net.ssl.SSLProtocolException: Received close_notify during handshake

I have a user who has a license to use Swiss Topo maps and requires my application to pull these tiles down.
In my main project I pull the tiles from the following type of URL https://wmts10.geo.admin.ch/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/3857/11/1074/[tile id].jpeg.
When I initially implemented this in my main project, which I compile as a non-modular image against OpenJDK11.0, there was an issue because of a known bug with TLSv1.3 pre openJDK11.02. The work around was to use the JVM param -Dhttps.protocols=TLSv1.2 to force my application to use TLSv1.2. This worked within my IDE but when I made the image using Beryx Badass Runtime it's as if the JVM param is ignored, I do see that Beryx has added it to the batch file that launches the image though.
I then decided I would try against OpenJDK 11.02 as this was meant to have a fix for TLSv1.3 and doesn't require that I force the TLS version to 1.2 with the JVM param. Again, this works when running from within my IDE (without a JVM param) but when I use Beryx to create the runtime image I see the same SSLExceptions. If I build the runtime with the following JVM param -Djavax.net.debug=ssl:handshake I see the following (it looks like OpenJDK11.02 only tries TLSv1.2?):
Reprex.bat
WARNING: Unknown module: javafx.graphics specified to --add-exports
WARNING: Unknown module: javafx.controls specified to --add-exports
WARNING: Unknown module: javafx.controls specified to --add-exports
WARNING: Unknown module: javafx.graphics specified to --add-exports
WARNING: package javax.naming not in java.base
WARNING: Unknown module: javafx.controls specified to --add-exports
WARNING: Unknown module: javafx.base specified to --add-exports
WARNING: Unknown module: javafx.graphics specified to --add-exports
WARNING: Unknown module: javafx.graphics specified to --add-exports
WARNING: Unknown module: javafx.controls specified to --add-exports
WARNING: Unknown module: javafx.base specified to --add-exports
WARNING: Unknown module: javafx.controls specified to --add-exports
WARNING: Unknown module: javafx.graphics specified to --add-exports
WARNING: Unknown module: javafx.controls specified to --add-opens
WARNING: Unknown module: javafx.graphics specified to --add-opens
https://wmts10.geo.admin.ch/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/3857/11/1074/715.jpeg
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:17.146 GMT|null:-1|jdk.tls.keyLimits: entry = AES/GCM/NoPadding KeyUpdate 2^37. AES/GCM/NOPADDING:KEYUPDATE = 137438953472
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:17.571 GMT|null:-1|the previous server name in SNI (type=host_name (0), value=wmts10.geo.admin.ch) was replaced with (type=host_name (0), value=wmts10.geo.admin.ch)
javax.net.ssl|WARNING|1B|Thread-3|2022-11-30 13:10:17.586 GMT|null:-1|Signature algorithm, ed25519, is not supported by the underlying providers
javax.net.ssl|WARNING|1B|Thread-3|2022-11-30 13:10:17.587 GMT|null:-1|Signature algorithm, ed448, is not supported by the underlying providers
javax.net.ssl|WARNING|1B|Thread-3|2022-11-30 13:10:17.587 GMT|null:-1|Signature algorithm, SHA256withECDSA, is not supported by the underlying providers
javax.net.ssl|WARNING|1B|Thread-3|2022-11-30 13:10:17.587 GMT|null:-1|Signature algorithm, SHA384withECDSA, is not supported by the underlying providers
javax.net.ssl|WARNING|1B|Thread-3|2022-11-30 13:10:17.587 GMT|null:-1|Signature algorithm, SHA512withECDSA, is not supported by the underlying providers
javax.net.ssl|WARNING|1B|Thread-3|2022-11-30 13:10:17.589 GMT|null:-1|Signature algorithm, SHA224withECDSA, is not supported by the underlying providers
javax.net.ssl|WARNING|1B|Thread-3|2022-11-30 13:10:17.590 GMT|null:-1|Signature algorithm, SHA1withECDSA, is not supported by the underlying providers
javax.net.ssl|INFO|1B|Thread-3|2022-11-30 13:10:17.591 GMT|null:-1|No available application protocols
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:17.592 GMT|null:-1|Ignore, context unavailable extension: application_layer_protocol_negotiation
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:17.593 GMT|null:-1|Ignore, context unavailable extension: cookie
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:17.622 GMT|null:-1|No session to resume.
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:17.622 GMT|null:-1|Ignore, context unavailable extension: pre_shared_key
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:17.623 GMT|null:-1|Produced ClientHello handshake message (
"ClientHello": {
"client version" : "TLSv1.2",
"random" : "31 5F 56 DC E8 EC 9D 92 1B C6 63 D0 F2 B7 62 83 18 E9 3E 13 6D D2 6D 0E 5E 63 39 7D 18 58 66 0E",
"session id" : "A3 84 68 4B EB 32 A8 27 22 62 73 44 42 03 76 CE 7C E4 A9 88 FC D1 E6 98 9D 70 BF D6 E0 D5 5F 20",
"cipher suites" : "[TLS_AES_128_GCM_SHA256(0x1301), TLS_AES_256_GCM_SHA384(0x1302), TLS_RSA_WITH_AES_256_GCM_SHA384(0x009D), TLS_DHE_RSA_WITH_AES_256_GCM_SHA384(0x009F), TLS_DHE_DSS_WITH_AES_256_GCM_SHA384(0x00A3), TLS_RSA_WITH_AES_128_GCM_SHA256(0x009C), TLS_DHE_RSA_WITH_AES_128_GCM_SHA256(0x009E), TLS_DHE_DSS_WITH_AES_128_GCM_SHA256(0x00A2), TLS_RSA_WITH_AES_256_CBC_SHA256(0x003D), TLS_DHE_RSA_WITH_AES_256_CBC_SHA256(0x006B), TLS_DHE_DSS_WITH_AES_256_CBC_SHA256(0x006A), TLS_RSA_WITH_AES_256_CBC_SHA(0x0035), TLS_DHE_RSA_WITH_AES_256_CBC_SHA(0x0039), TLS_DHE_DSS_WITH_AES_256_CBC_SHA(0x0038), TLS_RSA_WITH_AES_128_CBC_SHA256(0x003C), TLS_DHE_RSA_WITH_AES_128_CBC_SHA256(0x0067), TLS_DHE_DSS_WITH_AES_128_CBC_SHA256(0x0040), TLS_RSA_WITH_AES_128_CBC_SHA(0x002F), TLS_DHE_RSA_WITH_AES_128_CBC_SHA(0x0033), TLS_DHE_DSS_WITH_AES_128_CBC_SHA(0x0032)]",
"compression methods" : "00",
"extensions" : [
]
}
)
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:40.229 GMT|null:-1|Received alert message (
"Alert": {
"level" : "warning",
"description": "close_notify"
}
)
javax.net.ssl|ERROR|1B|Thread-3|2022-11-30 13:10:40.230 GMT|null:-1|Fatal (UNEXPECTED_MESSAGE): Received close_notify during handshake (
"throwable" : {
javax.net.ssl.SSLProtocolException: Received close_notify during handshake
at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Unknown Source)
at java.base/sun.security.ssl.TransportContext.dispatch(Unknown Source)
at java.base/sun.security.ssl.SSLTransport.decode(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.decode(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at sample.Main$1.call(Main.java:60)
at javafx.concurrent.Task$TaskCallable.call(Task.java:1425)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)}
)
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:40.231 GMT|null:-1|close the underlying socket
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:40.232 GMT|null:-1|close the SSL connection (passive)
javax.net.ssl.SSLProtocolException: Received close_notify during handshake
at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Unknown Source)
at java.base/sun.security.ssl.TransportContext.dispatch(Unknown Source)
at java.base/sun.security.ssl.SSLTransport.decode(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.decode(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at sample.Main$1.call(Main.java:60)
at javafx.concurrent.Task$TaskCallable.call(Task.java:1425)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
You will also notice a number of WARNING: Unknown module: messages at the start of that output but I'll address those later.
I have created a reprex project which can be found at https://github.com/chrisrush1/MVPDoExportsTLSReprex
I've included some commented out jvm params in the build.gradle which I've been using to see more detail on the SSL exception and to force the TLS version.
Within the Main.java there is some code I've commented out that will force the TLS version in code, I tried this to see if the Beryx runtime was failing to pass the JVM param but that isn't the issue.
Something different happens with the SSL request when running the image Beryx runtime creates than when the application is just run within the IDE and I'm struggling to see what that is.
Within the runtime block in my build.gradle I do the follow just to make sure it is using the correct OpenJDK which I set using the Env var JAVA_HOME, I don't think it should be necessary though.
runtime {
javaHome.set(System.getenv('JAVA_HOME'))
println "runtime JavaHome path:${javaHome.get()}"
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
}
In addition to the above issue you can see the WARNING messages about 'unknown module'. I've included all the add-exports and add-opens commands required by my main project in the build.gradle for this reprex project so that all these WARNINGS can be seen. These warnings are odd because they would imply the modules are missing but the main application runs correctly and wouldn't if I removed the add-exports/add-opens so I'm not sure why when launching the image from the bat file created these are displayed? javafx.graphics and javafx.controls are vital to my main project so they must be in the image as it launches and runs without issue so why the warnings?
The modules file created for my image with badass runtime contains the following
bin\java --list-modules
java.base#11.0.2
java.compiler#11.0.2
java.datatransfer#11.0.2
java.desktop#11.0.2
java.instrument#11.0.2
java.logging#11.0.2
java.management#11.0.2
java.management.rmi#11.0.2
java.naming#11.0.2
java.net.http#11.0.2
java.prefs#11.0.2
java.rmi#11.0.2
java.scripting#11.0.2
java.se#11.0.2
java.security.jgss#11.0.2
java.security.sasl#11.0.2
java.smartcardio#11.0.2
java.sql#11.0.2
java.sql.rowset#11.0.2
java.transaction.xa#11.0.2
java.xml#11.0.2
java.xml.crypto#11.0.2
jdk.accessibility#11.0.2
jdk.aot#11.0.2
jdk.attach#11.0.2
jdk.charsets#11.0.2
jdk.compiler#11.0.2
jdk.crypto.cryptoki#11.0.2
jdk.crypto.ec#11.0.2
jdk.crypto.mscapi#11.0.2
jdk.dynalink#11.0.2
jdk.editpad#11.0.2
jdk.hotspot.agent#11.0.2
jdk.httpserver#11.0.2
jdk.internal.ed#11.0.2
jdk.internal.jvmstat#11.0.2
jdk.internal.le#11.0.2
jdk.internal.opt#11.0.2
jdk.internal.vm.ci#11.0.2
jdk.internal.vm.compiler#11.0.2
jdk.internal.vm.compiler.management#11.0.2
jdk.jartool#11.0.2
jdk.javadoc#11.0.2
jdk.jcmd#11.0.2
jdk.jconsole#11.0.2
jdk.jdeps#11.0.2
jdk.jdi#11.0.2
jdk.jdwp.agent#11.0.2
jdk.jfr#11.0.2
jdk.jlink#11.0.2
jdk.jshell#11.0.2
jdk.jsobject#11.0.2
jdk.jstatd#11.0.2
jdk.localedata#11.0.2
jdk.management#11.0.2
jdk.management.agent#11.0.2
jdk.management.jfr#11.0.2
jdk.naming.dns#11.0.2
jdk.naming.rmi#11.0.2
jdk.net#11.0.2
jdk.pack#11.0.2
jdk.rmic#11.0.2
jdk.scripting.nashorn#11.0.2
jdk.scripting.nashorn.shell#11.0.2
jdk.sctp#11.0.2
jdk.security.auth#11.0.2
jdk.security.jgss#11.0.2
jdk.unsupported#11.0.2
jdk.unsupported.desktop#11.0.2
jdk.xml.dom#11.0.2
jdk.zipfs#11.0.2
My uderstanding was that the runtime plugin puts the javafx dependencies in the jar file under /lib along with my project classes, I see a lot of them in there including packages that are in javafx.base, javafx.controls and javafx.graphics, is this not where my image is using them from? Thanks
Thanks for any help with these issues.
This issue is NOT related to JavaFX specifically, it will manifest in any Java program packaged as modular jlinked images that use SSL.
In order for SSL to work in a modular Java image, you need to include the following module in the image:
jdk.crypto.cryptoki
Without this module, the jlinked image will hang trying to get an SSL socket, and eventually (after about 30 seconds) fail with the error:
javax.net.ssl.SSLProtocolException: Received close_notify during handshake
// at SSL related stack trace...
This will occur because jlink won't, by default, bind in the sun security provider for public key cryptography that is required to support SSL connections.
From the cryptoki documentation:
Provides the implementation of the SunPKCS11 security provider.
You need some kind of public key security provider for SSL to function, either the standard one from the JDK or a 3rd party one like Bouncy Castle. Without it, the rest of the app will work, but some cryptography will not. The lookup and usage of security algorithms is a runtime thing, so everything will work until you try to use it (e.g. when you try to open an SSL connection).
To fix it, you can create a modular app that requires the necessary module in the module-info.java file with this line:
requires jdk.crypto.cryptoki;
Demonstration
I am going to give a Maven-based answer as I am more familiar with that toolset. I don't know Gradle well enough to advise on how to translate this answer for Gradle. For testing, I used OpenJDK 19.0.1 and JavaFX 19 on OS X (Intel) 13.0.1.
This example is derived from code by rickybobby.
To build the linked app:
mvn javafx:jlink
To run the linked app:
./target/app/bin/app
src/main/java/sample/Main.java
package sample;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.concurrent.Task;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
import java.io.InputStream;
import java.net.URL;
public class Main extends Application {
private static final String BASE_URL = "https://wmts10.geo.admin.ch/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/3857/11/1074/";
private ImageView iv;
#Override
public void start(Stage primaryStage) throws Exception {
HBox hBox = new HBox(0.0);
hBox.setPrefHeight(400);
hBox.setPrefWidth(600);
iv = new ImageView();
iv.setFitWidth(200);
iv.setFitHeight(150);
iv.setPreserveRatio(true);
hBox.getChildren().add(iv);
primaryStage.setScene(new Scene(hBox, 300, 275));
primaryStage.show();
//load map tile from server
Task<Void> mapTileLoadTask = new Task<>() {
#Override
protected Void call() throws Exception {
Thread.sleep(1000);
Image image = null;
for (int i = 715; i < 739; i++) {
String urlString = BASE_URL + i + ".jpeg";
System.out.println(urlString);
URL url = new URL(urlString);
try {
//open inputStream to show SSLHandshakeExpception seen in main project
InputStream inputStream = url.openConnection().getInputStream();
image = new Image(urlString, true);
} catch (Exception e) {
e.printStackTrace();
}
if (image != null)
setMapImage(image);
Thread.sleep(10);
}
return null;
}
};
new Thread(mapTileLoadTask).start();
}
public synchronized void setMapImage(Image image) {
Platform.runLater(() -> {
if (iv != null)
iv.setImage(image);
});
}
public static void main(String[] args) {
launch(args);
}
}
src/main/java/module-info.java
module com.example.maptilemaven {
requires javafx.controls;
// if you comment out this line, SSL handshakes will fail in jlinked images.
requires jdk.crypto.cryptoki;
exports sample;
}
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>maptilemaven</artifactId>
<version>1.0-SNAPSHOT</version>
<name>maptilemaven</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>19</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>19</source>
<target>19</target>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<!-- Default configuration for running with: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>com.example.maptilemaven/sample.Main</mainClass>
<launcher>app</launcher>
<jlinkZipName>app</jlinkZipName>
<jlinkImageName>app</jlinkImageName>
<noManPages>true</noManPages>
<stripDebug>true</stripDebug>
<noHeaderFiles>true</noHeaderFiles>
<!-- Normally the javafx maven plugin will find jlink in JAVA_HOME, but if you want to specify which version to use, set that here:
<jlinkExecutable>/Users/username/Library/Java/JavaVirtualMachines/openjdk-19.0.1/Contents/Home/bin/jlink</jlinkExecutable>
-->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Verify of linked modules with this command:
.target/app/bin/java --list-modules
Outputs:
com.example.maptilemaven
java.base#19.0.1
java.datatransfer#19.0.1
java.desktop#19.0.1
java.prefs#19.0.1
java.xml#19.0.1
javafx.base#19
javafx.controls#19
javafx.graphics#19
jdk.crypto.cryptoki#19.0.1
jdk.crypto.ec#19.0.1
jdk.unsupported#19.0.1

Sharing file create by an app in MODE_PRIVATE

So I have an app which writes sensor data to a csv file via FileOutputStream in MODE_PRIVATE
FileOutputStream fos = null;
try {
fos = context.openFileOutput(FILE_NAME,Context.MODE_PRIVATE);
for(int i = 0; i< signalList.size(); i++){
Signal s = signalList.get(i);
fos.write(s.toString().getBytes());
}
Log.d("WRITESTATUS","Success");
}
Now I wanted to share this file with other apps (whatsapp,email etc.). To achieve that, I am using the code below to share the intent. I was trying to use MODE_WORLD..something but that didn't work because it was deprecated so I learned through the other stackoverflow questions that we need to use FileProvider to make that happen but that didn't work either.
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("*/*");
File file = getFileStreamPath(FILE_NAME);
Uri uri = FileProvider.getUriForFile(this,"com.example.writefile",file);
sharingIntent.putExtra(Intent.EXTRA_STREAM, uri);
sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(sharingIntent, "Share SENSOR Data"));
<provider
android:authorities="com.example.writefile"
android:name="androidx.core.content.FileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/provider_path"/>
</provider>
ERROR LOG
2020-06-22 16:27:34.047 6578-6578/? E/ample.writefil: Unknown bits set in runtime_flags: 0x8000
2020-06-22 16:27:34.147 6578-6578/com.example.writefile E/libc: Access denied finding property "vendor.iop.enable_uxe"
2020-06-22 16:27:36.043 6578-6578/com.example.writefile E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.writefile, PID: 6578
java.lang.IllegalStateException: Could not execute method for android:onClick
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:402)
at android.view.View.performClick(View.java:7158)
at android.view.View.performClickInternal(View.java:7135)
at android.view.View.access$3500(View.java:801)
at android.view.View$PerformClick.run(View.java:27373)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:235)
at android.app.ActivityThread.main(ActivityThread.java:7441)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:397)
at android.view.View.performClick(View.java:7158) 
at android.view.View.performClickInternal(View.java:7135) 
at android.view.View.access$3500(View.java:801) 
at android.view.View$PerformClick.run(View.java:27373) 
at android.os.Handler.handleCallback(Handler.java:883) 
at android.os.Handler.dispatchMessage(Handler.java:100) 
at android.os.Looper.loop(Looper.java:235) 
at android.app.ActivityThread.main(ActivityThread.java:7441) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935) 
Caused by: java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/com.example.writefile/files/sensor.csv
at androidx.core.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:744)
at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:418)
at com.example.writefile.MainActivity.Clicked(MainActivity.java:266)
at java.lang.reflect.Method.invoke(Native Method) 
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:397) 
at android.view.View.performClick(View.java:7158) 
at android.view.View.performClickInternal(View.java:7135) 
at android.view.View.access$3500(View.java:801) 
at android.view.View$PerformClick.run(View.java:27373) 
at android.os.Handler.handleCallback(Handler.java:883) 
at android.os.Handler.dispatchMessage(Handler.java:100) 
at android.os.Looper.loop(Looper.java:235) 
at android.app.ActivityThread.main(ActivityThread.java:7441) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935) 
Change this and it will work- I have taken hint from here and tried different configuration and this works, I don't know why.
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<files-path
name="sensor"
path="."/>
</paths>

truthy doesn't work with sbt new

I've created a template project with giter8, and trying to add conditional expression.
in the defaults.properties I added:
param=true
and in the template file I added:
$if(param.truthy)$
....
$endif$
when I'm generating the project with:
g8 file://proj.g8
everything works as expected.
in the interactive part, param would have 2 options:
param [YES/no]:
and the generated file will include the additional text based on the value of the param
But, when I generate the project with:
sbt new file://proj.g8
param is being treated as a string.
during the interactive part, there are no yes/no options:
param [yes]:
and I'm getting the following error:
Exiting due to error in the template File:
/tmp/giter8-135496483100759/src/main/g8/build.sbt, context [anonymous]
44:6 internal error: org.stringtemplate.v4.compiler.STException:
context [anonymous] 44:6 no such property or can't access:
java.lang.String.truthy Caused by:
org.stringtemplate.v4.misc.STNoSuchPropertyException: no such
property: java.lang.String.truthy at
org.stringtemplate.v4.misc.ObjectModelAdaptor.throwNoSuchProperty(ObjectModelAdaptor.java:167)
at
org.stringtemplate.v4.misc.ObjectModelAdaptor.getProperty(ObjectModelAdaptor.java:89)
at
org.stringtemplate.v4.Interpreter.getObjectProperty(Interpreter.java:1200)
at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:210) at
org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145) at
org.stringtemplate.v4.ST.write(ST.java:427) at
org.stringtemplate.v4.ST.render(ST.java:497) at
org.clapper.scalasti.ST.render(ST.scala:285) at
giter8.G8$.applyTemplate(g8.scala:102) at
giter8.G8$.write(g8.scala:154) at giter8.G8$.write(g8.scala:138) at
giter8.G8$.$anonfun$writeTemplates$3(g8.scala:396) at
scala.util.control.Exception$Catch.$anonfun$opt$1(Exception.scala:242)
at scala.util.control.Exception$Catch.apply(Exception.scala:224) at
scala.util.control.Exception$Catch.opt(Exception.scala:242) at
giter8.G8$.$anonfun$writeTemplates$2(g8.scala:396) at
scala.collection.immutable.Stream.foreach(Stream.scala:530) at
giter8.G8$.writeTemplates(g8.scala:386) at
giter8.G8$.$anonfun$applyT$1(g8.scala:257) at
scala.util.Either$RightProjection.flatMap(Either.scala:702) at
giter8.G8$.applyT(g8.scala:249) at
giter8.G8$.fromDirectory(g8.scala:62) at
giter8.JgitHelper$.$anonfun$run$3(JgitHelper.scala:64) at
scala.util.Either$RightProjection.flatMap(Either.scala:702) at
giter8.JgitHelper$.run(JgitHelper.scala:63) at
giter8.Giter8.$anonfun$run$2(giter8.scala:34) at
scala.Option.map(Option.scala:146) at
giter8.Giter8.run(giter8.scala:33) at
sbtgiter8resolver.Giter8TemplateResolver.run(Giter8TemplateResolver.scala:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498) at
sbt.TemplateCommandUtil$.call(TemplateCommand.scala:100) at
sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:78) at
sbt.TemplateCommandUtil$.$anonfun$run$1(TemplateCommand.scala:58) at
sbt.TemplateCommandUtil$.$anonfun$run$1$adapted(TemplateCommand.scala:54)
at
scala.collection.LinearSeqOptimized.find(LinearSeqOptimized.scala:111)
at
scala.collection.LinearSeqOptimized.find$(LinearSeqOptimized.scala:108)
at scala.collection.immutable.List.find(List.scala:86) at
sbt.TemplateCommandUtil$.run(TemplateCommand.scala:54) at
sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:41) at
sbt.TemplateCommandUtil$.$anonfun$templateCommand$2(TemplateCommand.scala:24)
at sbt.Command$.$anonfun$applyEffect$4(Command.scala:134) at
sbt.Command$.$anonfun$applyEffect$2(Command.scala:130) at
sbt.MainLoop$.processCommand(MainLoop.scala:153) at
sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:136) at
sbt.State$$anon$1.runCmd$1(State.scala:242) at
sbt.State$$anon$1.process(State.scala:248) at
sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:136) at
sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
at sbt.MainLoop$.next(MainLoop.scala:136) at
sbt.MainLoop$.run(MainLoop.scala:129) at
sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:107) at
sbt.io.Using.apply(Using.scala:22) at
sbt.MainLoop$.runWithNewLog(MainLoop.scala:101) at
sbt.MainLoop$.runAndClearLast(MainLoop.scala:57) at
sbt.MainLoop$.runLoggedLoop(MainLoop.scala:42) at
sbt.MainLoop$.runLogged(MainLoop.scala:34) at
sbt.StandardMain$.runManaged(Main.scala:113) at
sbt.xMain.run(Main.scala:76) at
xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109) at
xsbt.boot.Launch$.withContextLoader(Launch.scala:128) at
xsbt.boot.Launch$.run(Launch.scala:109) at
xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35) at
xsbt.boot.Launch$.launch(Launch.scala:117) at
xsbt.boot.Launch$.apply(Launch.scala:18) at
xsbt.boot.Boot$.runImpl(Boot.scala:41) at
xsbt.boot.Boot$.main(Boot.scala:17) at
xsbt.boot.Boot.main(Boot.scala)
at giter8.G8$STErrorHandler.runTimeError(g8.scala:110) at
giter8.G8$STErrorHandler.runTimeError(g8.scala:105) at
org.stringtemplate.v4.misc.ErrorManager.runTimeError(ErrorManager.java:137)
at
org.stringtemplate.v4.Interpreter.getObjectProperty(Interpreter.java:1203)
at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:210) at
org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145) at
org.stringtemplate.v4.ST.write(ST.java:427) at
org.stringtemplate.v4.ST.render(ST.java:497) at
org.clapper.scalasti.ST.render(ST.scala:285) at
giter8.G8$.applyTemplate(g8.scala:102) at
giter8.G8$.write(g8.scala:154) at giter8.G8$.write(g8.scala:138) at
giter8.G8$.$anonfun$writeTemplates$3(g8.scala:396) at
scala.util.control.Exception$Catch.$anonfun$opt$1(Exception.scala:242)
at scala.util.control.Exception$Catch.apply(Exception.scala:224) at
scala.util.control.Exception$Catch.opt(Exception.scala:242) at
giter8.G8$.$anonfun$writeTemplates$2(g8.scala:396) at
scala.collection.immutable.Stream.foreach(Stream.scala:530) at
giter8.G8$.writeTemplates(g8.scala:386) at
giter8.G8$.$anonfun$applyT$1(g8.scala:257) at
scala.util.Either$RightProjection.flatMap(Either.scala:702) at
giter8.G8$.applyT(g8.scala:249) at
giter8.G8$.fromDirectory(g8.scala:62) at
giter8.JgitHelper$.$anonfun$run$3(JgitHelper.scala:64) at
scala.util.Either$RightProjection.flatMap(Either.scala:702) at
giter8.JgitHelper$.run(JgitHelper.scala:63) at
giter8.Giter8.$anonfun$run$2(giter8.scala:34) at
scala.Option.map(Option.scala:146) at
giter8.Giter8.run(giter8.scala:33) at
sbtgiter8resolver.Giter8TemplateResolver.run(Giter8TemplateResolver.scala:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498) at
sbt.TemplateCommandUtil$.call(TemplateCommand.scala:100) at
sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:78) at
sbt.TemplateCommandUtil$.$anonfun$run$1(TemplateCommand.scala:58) at
sbt.TemplateCommandUtil$.$anonfun$run$1$adapted(TemplateCommand.scala:54)
at
scala.collection.LinearSeqOptimized.find(LinearSeqOptimized.scala:111)
at
scala.collection.LinearSeqOptimized.find$(LinearSeqOptimized.scala:108)
at scala.collection.immutable.List.find(List.scala:86) at
sbt.TemplateCommandUtil$.run(TemplateCommand.scala:54) at
sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:41) at
sbt.TemplateCommandUtil$.$anonfun$templateCommand$2(TemplateCommand.scala:24)
at sbt.Command$.$anonfun$applyEffect$4(Command.scala:134) at
sbt.Command$.$anonfun$applyEffect$2(Command.scala:130) at
sbt.MainLoop$.processCommand(MainLoop.scala:153) at
sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:136) at
sbt.State$$anon$1.runCmd$1(State.scala:242) at
sbt.State$$anon$1.process(State.scala:248) at
sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:136) at
sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
at sbt.MainLoop$.next(MainLoop.scala:136) at
sbt.MainLoop$.run(MainLoop.scala:129) at
sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:107) at
sbt.io.Using.apply(Using.scala:22) at
sbt.MainLoop$.runWithNewLog(MainLoop.scala:101) at
sbt.MainLoop$.runAndClearLast(MainLoop.scala:57) at
sbt.MainLoop$.runLoggedLoop(MainLoop.scala:42) at
sbt.MainLoop$.runLogged(MainLoop.scala:34) at
sbt.StandardMain$.runManaged(Main.scala:113) at
sbt.xMain.run(Main.scala:76) at
xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109) at
xsbt.boot.Launch$.withContextLoader(Launch.scala:128) at
xsbt.boot.Launch$.run(Launch.scala:109) at
xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35) at
xsbt.boot.Launch$.launch(Launch.scala:117) at
xsbt.boot.Launch$.apply(Launch.scala:18) at
xsbt.boot.Boot$.runImpl(Boot.scala:41) at
xsbt.boot.Boot$.main(Boot.scala:17) at
xsbt.boot.Boot.main(Boot.scala)
I'm using version 0.11.0-M3 for both g8 and sbt-giter8 plugin
How can I fix this problem?
EDIT: some more details:
I'm using sbt 1.1.1 (for both the g8 project and the sbt launcher on my machine)
I added the plugin in the g8 project in the file project/plugins.sbt with
addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.11.0-M3")
if I remove the truthy parts from the template, the project is generated correctly from sbt new
This issue been fixed in sbt 1.2.0
in order to fix, should use:
sbt -Dsbt.version=1.2.0 new file://proj.g8
The version of giter8 used internally for sbt new is fixed and adding sbt-giter8 plugin won't change it. sbt 1.1.1 uses sbt-giter8-resolver v0.1.3, which uses giter8 0.7.2 (which doesn't support conditionals).
You could update sbt-giter8-resolver, publish it locally and try to replace the default Giter8TemplatePlugin, but I think it's not worth it. Just use g8 directly until sbt gets updated.
There was an effort to support arbitrary giter8 version set in the template, but something went wrong and this feature has been reverted.

Fatal Exception: java.lang.RuntimeException : unable to start Activity

Hey guys i m new in Android studio help me to out following. i use ActionBarSherlock Library and it hold Reference of current Fragment instance when user pause application.
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.maruticourier.android/com.myapplication.activity.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2266)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2316)
at android.app.ActivityThread.access$600(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1298)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5225)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.NullPointerException**
at com.myapplication.fragment.PendingTask.checksyncdata(PendingTask.java:378)
at com.myapplication.fragment.PendingTask.onCreateView(PendingTask.java:182)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:548)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
at android.app.Activity.performStart(Activity.java:5143)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2239)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2316)
at android.app.ActivityThread.access$600(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1298)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5225)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(NativeStart.java)
you must initialize Activity Object ActionBarSherlock project file

Reflecting Assemblies on Mono for Android

I'm creating an app "plugin" dll that loads at run-time for my Mono for Android App and starts a new Activity. (the app will be installed ad-hoc - so no comments on downloading executable code)
I'm coming from Obj-C on iOS - where you can include .nibs and ViewControllers in a library.
I can have the main Android app and the loaded dll both reference another common dll, and load objects just fine.
The following works:
var test = plugin.CreateInstance("Test.Satellite.testClass");
MethodInfo getString = test.GetType().GetMethod("getString");
MethodInfo tryPatient = test.GetType().GetMethod("tryPatient");
Where
public class testClass
{
public string getString ()
{
return "This was read from the object";
}
public string tryPatient ()
{
Patient p = new Patient();
p.Name = "This was created from the Core/Common DLL";
return p.Name;
}
}
However, when I try to load an Activity (either through CreateInstance or Intent/StartActivity) it gives the following exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: test.satellite.RootActivity
at Android.Runtime.JNIEnv.FindClass (System.String classname) [0x00087] in /Users/builder/data/lanes/monodroid-mac-monodroid-4.2.7-branch/0e9eea34/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:275
at Android.Runtime.JNIEnv.FindClass (System.Type type) [0x00009] in /Users/builder/data/lanes/monodroid-mac-monodroid-4.2.7-branch/0e9eea34/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:233
--- End of managed exception stack trace ---
java.lang.NoClassDefFoundError: test.satellite.RootActivity
at test.MainActivity.n_onCreate(Native Method)
at test.MainActivity.onCreate(MainActivity.java:29)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.access$2200(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: test.satellite.RootActivity in loader dalvik.system.PathClassLoader#44e8c678
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
... 15 more
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <IL 0x000e0, 0x00670>
at System.Reflection.MethodBase.Invoke (object,object[]) <IL 0x00006, 0x0008f>
at Test.MainActivity.OnCreate (Android.OS.Bundle) [0x001e9] in /Users/stephen/Projects/test/test/MainActivity.cs:86
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00010] in /Users/builder/data/lanes/monodroid-mac-monodroid-4.2.7-branch/0e9eea34/source/monodroid/src/Mono.Android/platforms/android-8/src/generated/Android.App.Activity.cs:1490
at (wrapper dynamic-method) object.ca46b703-b14e-4853-b371-499ea96364fc (intptr,intptr,intptr) <IL 0x00012, 0x00033>
What I can read from that is that the Dalvik can't find the class test.satellite.RootActivity - but it found test.satellite.testClass just fine...?
Any help would be appreciated.
It looks like you are inconsistent about the casing of packages. Might that be the problem?
"Test.Satellite.testClass" -- works
"test.satellite.RootActivity" -- doesn't work

Resources