Open hukusuke1007 opened 1 year ago
same here..
Same. Tried to run the example application but get this error. Overriding onStreetViewPanoramaChange and catching the exception doesn't help.
That's an sdk issue, see here: https://issuetracker.google.com/issues/222232904
And BTW, if you set initPanoId instead of initPos it won't crash - not very useful but perhaps it might help someone
I made a fork with a fix, hope it helps:
flutter_google_street_view:
git:
url: https://github.com/liorboyango/flutter_street_view.git
path: flutter_google_street_view
ref: master
I am also having this issue. Adding the above to my pubspec.yaml gives the following issue. Any help would be appreciated:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flutter_google_street_view:compileDebugJavaWithJavac'.
> error: invalid source release: 17
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 8s```
I am also having this issue. Adding the above to my pubspec.yaml gives the following issue. Any help would be appreciated:
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':flutter_google_street_view:compileDebugJavaWithJavac'. > error: invalid source release: 17 * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 8s```
Same issue here when build with Codemagic
@liorboyango would it be possible to merge your fork and publish a new release to pub.dev?
I am also having this issue. Adding the above to my pubspec.yaml gives the following issue. Any help would be appreciated:
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':flutter_google_street_view:compileDebugJavaWithJavac'. > error: invalid source release: 17 * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 8s```
Set your Android env to use Java17
See solution here: https://github.com/zyzdev/flutter_street_view/issues/39
That's an sdk issue, see here: https://issuetracker.google.com/issues/222232904
And BTW, if you set initPanoId instead of initPos it won't crash - not very useful but perhaps it might help someone
@liorboyango Still app is crashing, please tell the solution for this, i used initPanoId instead of pass lat longs, and app crashes.
class StreetViewPanoramaInitDemo extends StatefulWidget { const StreetViewPanoramaInitDemo({super.key});
@override
State
class _StreetViewPanoramaInitDemoState
extends State
@override void initState() { super.initState(); Future.delayed(Duration.zero, () { checkStreetView(lat, long); // checkEnableApis(); }); }
String initPanoId = '';
checkEnableApis(){ checkStaticStreetView(apiKey: APIservices.googleKey,lat: lat.toString(),long: long.toString()); checkDynamicStreetView(apiKey: APIservices.googleKey,lat: lat.toString(),long: long.toString()); }
@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Street View Init Demo'), leading: IconButton( icon: const Icon(Icons.arrow_back), onPressed: () => Navigator.pop(context), ), ), body: SafeArea( child: Stack( children: [ FlutterGoogleStreetView( userNavigationEnabled: false, // initPos: LatLng(lat, long), initPanoId: initPanoId, initSource: StreetViewSource.def, initBearing: 30, streetNamesEnabled: false, zoomGesturesEnabled: true, onStreetViewCreated: (StreetViewController controller) async { debugPrint('Street View Created >>>'); }, ), ], ), ), ); }
Future
// Check Street View at the requested location
final uri =
Uri.https('maps.googleapis.com', 'maps/api/streetview/metadata', {
'key': apiKey,
'location': '$latitude,$longitude',
});
final response = await http.get(uri);
if (response.statusCode == 200) {
final data = jsonDecode(response.body);
final success = data['status'] == 'OK';
if (success) {
log('Success >>> ${data.toString()}');
debugPrint('Street View is available for this location.');
// Use the exact lat/long
lat = latitude;
long = longitude;
initPanoId = data['pano_id'].toString();
setState(() {});
} else {
debugPrint('Street View not available at this location.');
// Find the nearest Street View within a search range
await _findNearbyStreetView(
latitude, longitude, 100); // Start with 100 meters
}
} else {
debugPrint(
'Failed to fetch Street View metadata. Status code: ${response.statusCode}');
}
}
Future
// Define an expanding search radius (increment by 100 meters per iteration)
int maxRadius = 5000; // You can set a max range limit (5 km in this case)
for (int radius = searchRadius; radius <= maxRadius; radius += 100) {
debugPrint('Searching for Street View within $radius meters...');
// Define the Street View metadata API with location and radius
final streetViewUri =
Uri.https('maps.googleapis.com', 'maps/api/streetview/metadata', {
'key': apiKey,
'location': '$latitude,$longitude',
'radius': radius.toString(), // Expand search with radius
});
final streetViewResponse = await http.get(streetViewUri);
if (streetViewResponse.statusCode == 200) {
final streetViewData = jsonDecode(streetViewResponse.body);
if (streetViewData['status'] == 'OK') {
// Found a nearby Street View
final foundLat = streetViewData['location']['lat'];
final foundLng = streetViewData['location']['lng'];
final paranomaId = streetViewData['pano_id'];
log('Nearby Street View found >>> ${streetViewData.toString()}');
debugPrint(
'Street View available at nearby location: ($foundLat, $foundLng)');
lat = double.parse(foundLat.toString());
long = double.parse(foundLng.toString());
initPanoId = paranomaId;
debugPrint('initPanoId>>>> $initPanoId');
setState(() {});
break;
} else {
debugPrint(
'No Street View found within $radius meters. Expanding search...');
}
}
}
}
Future
final response = await http.get(uri);
if (response.statusCode == 200) {
print('Static Street View is enabled.------');
} else {
print(
'Static Street View is not enabled. Status Code: ${response.statusCode}');
}
}
Future
final response = await http.get(uri);
if (response.statusCode == 200) {
final data = jsonDecode(response.body);
debugPrint('data>>>${data.toString()}');
if (data['status'] == 'OK') {
print('Dynamic Street View is enabled.------');
} else {
print(
'Dynamic Street View is not available for this location, but API might still be enabled.');
}
} else {
print(
'Dynamic Street View is not enabled. Status Code: ${response.statusCode}');
}
} }
@liorboyango @lazytesting @Nicoeevee @yishaiSilver @BalaSundar009 @hukusuke1007
Does somebody find the solution for this? Apps keep crashing with the package flutter_google_street_view: ^3.1.4, giving error in console com.google.maps.api.android.lib6.common.apiexception.f: java.lang.NullPointerException: Parameter specified as non-null is null: method zyz.flutter.plugin.flutter_google_street_view.FlutterGoogleStreetView.onStreetViewPanoramaChange, parameter location
What is the solution for this? because there is not any update on package since 14 months, what to do next? Please reply
The app crashes when setting a location where Street View does not exist.