Why can't I run my app? - android

My app runs perfect for desktop and Android, but robovm with libgdx will not work. I downloaded the ios sdk on my mac and got everything set up. When I try to run it on the ios simulator, I get this error:
An internal error occurred during: "Launching Gravity".
Class com.badlogic.gdx.Gdx doesn't have field gl : com.badlogic.gdx.graphics.GLCommon;
failed to resolve in superclasses and interfaces
I am not quite sure what is wrong with this. here is my code for my robovm launcher. Is there something wrong with it?
package com.me.Mercify;
import org.robovm.apple.foundation.*;
import org.robovm.apple.uikit.*;
import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
public class RobovmLauncher extends UIApplicationDelegateAdapter {
protected IOSApplication createApplication() {
IOSApplicationConfiguration config = new IOSApplicationConfiguration();
config.orientationLandscape = true;
config.orientationPortrait = false;
return new IOSApplication(new GravityTwist(), config);
}
public static void main(String[] args) {
NSAutoreleasePool pool = new NSAutoreleasePool();
UIApplication.main(args, null, RobovmLauncher.class);
pool.close();
}
}

You need to update to the latest nightly build of libGDX, which contains an updated version of RoboVM which should resolve this error. LibGDX 0.9.9 depends on RoboVM 0.0.6, which is fairly outdated.

Related

FlashDevelop error creating APK for simple project

Apk cannot be build because of errors, some obvious troubleshooting doesnt fix it
I start an AIR Mobile AS3 App project. Finally I can say it correctly found its AIR and Flex folders. There have been threads about such issues but not with latest versions of Flex and mostly with AIR. So a new project with latest flex and AIR, I installed the AppMan package Flex SDK + AIR SDK 4.6.0. + 32.0.0
Obvious paths in the SetupSDK.bat are:
..(whatever drive)\FlashDevelop-5.3.3\Apps\flexairsdk\4.6.0+32.0.0
..(whatever drive)\FlashDevelop-5.3.3\Tools\android (that includes platform-tools containing adb.exe)
… and so application.xml must have ?
application xmlns="http://ns.adobe.com/air/application/32.0"
defaults in 28.0 but that changes nothing
Yes certificate is created from the bat
And that's it, a simple embedded image display:
I have to switch between Debug and Release when pressing F5 because repeating twice Debug or Repeat causes the error that var value for image is empty, but if you alternate it displays image in Device window so i will assume it compiles well.
Or deleting the project.swf generated on compilation also allows to display the image if running Debug or Release for first time.
But t he error is when running the PackageApp.bat and [1] for normal apk
http://www.flashdevelop.org/community/viewtopic.php?f=6&t=12144
This solved the issue. I had to install JRE 1.6 too since 1.8 has bugs with FD. set the path for java.home in jvm.config to use the JRE 1.6 folder, no more 'Variable not defined', it was common message, and now I can F5 without the error, thanks for the above tips for Bitmap still.
Regarding your code at: http://oneclickpaste.com/26534/
In Main.as try to close the import with a ; (just in case it's giving a weird technical issue).
example: import com.mee.ptest.PicTest;
In PicTest.as you need to fix this line: iPic = new PicTest.cTestPic();
To become as: iPic = new cTestPic() as Bitmap;.
Example for PicTest.as:
package com.mee.ptest
{
import flash.display.Bitmap;
import flash.display.Sprite;
public class PicTest extends Sprite
{
[Embed(source="../../../assets/testpic.jpg")]
private static var cTestPic :Class;
private var iPic :Bitmap;
public function PicTest()
{
iPic = new cTestPic() as Bitmap;
addChild(iPic);
}
}
}
And then example for Main.as:
import flash.desktop.NativeApplication;
import flash.events.Event;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
import flash.display.Bitmap;
import flash.display.*;
import com.mee.ptest.PicTest;
public class Main extends Sprite
{
public var pic : PicTest;
public function Main()
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.DEACTIVATE, deactivate);
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
//# check if app is ready to display visual items...
if (stage) { show_Pic(); }
else { addEventListener( Event.ADDED_TO_STAGE, show_Pic ); }
}
private function show_Pic() :void
{
pic = new PicTest();
addChild(pic);
}
private function deactivate(e:Event) :void
{
// make sure the app behaves well (or exits) when in background
//NativeApplication.nativeApplication.exit();
}
}

Use SQLiteNetextensions with Xamarin for Android-App

I've read some threads about SQLite for Xamarin but I'm still not able to set up SQLiteNetExtensions in a proper way. I'm currently developing an android app with Target Framework Android 7.1(API Level 25 - Nougat).
Can anybody tell me what I'm doing wrong?
I installed nuget packages:
Install-Package SQLiteNetExtensions -Version 2.0.0-alpha2 -Pre
Install-Package SQLite.Net-PCL -Version 3.1.1
According to: https://bitbucket.org/twincoders/sqlite-net-extensions
Then I set up my code.
using SQLite.Net.Attributes;
using SQLiteNetExtensions.Attributes;
using System;
namespace AppName.Resources.Model
{
public class Entry
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
[ForeignKey(typeof(Stock))]
public int StockId { get; set; }
public DateTime Date { get; set; }
public double Amount { get; set; }
}
}
using SQLite.Net.Attributes;
using SQLiteNetExtensions.Attributes;
using System;
using System.Collections.Generic;
namespace AppName.Resources.Model
{
public class Stock
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string Name { get; set; }
public DateTime LastUpdated { get; set; }
[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<Entry> Entrys { get; set; }
}
}
using Android.Util;
using AppName.Resources.Model;
using SQLite.Net;
using SQLite.Net.Platform.XamarinAndroid;
using SQLiteNetExtensions.Extensions;
using System.Collections.Generic;
using System.IO;
namespace AppName.Resources.DataHelper
{
public class DataBase
{
string folder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
public bool CreateDataBase()
{
try
{
using (var stocksDBConnection = new SQLiteConnection(new SQLitePlatformAndroid(), Path.Combine(folder, "Stock.db")))
{
stocksDBConnection.CreateTable<Entry>();
stocksDBConnection.CreateTable<Stock>();
return true;
}
}
catch (SQLiteException ex)
{
Log.Info("SQLiteEx", ex.Message);
return false;
}
}
public bool InsertIntoTableStock(object stock)
{
try
{
using (var stocksDBConnection = new SQLiteConnection(new SQLitePlatformAndroid(), Path.Combine(folder, "Stock.db")))
{
stocksDBConnection.InsertWithChildren(stock);
return true;
}
}
catch (SQLiteException ex)
{
Log.Info("SQLiteEx", ex.Message);
return false;
}
}
...
These References were added by nuget:
SQLite-net
SQLite.Net
SQLite.Net.Platform.XamarinAndroid
SQLiteNetExtensions
SQLitePCLRaw.Batteries_green
SQLitePCLRaw.Core
SQLitePCLRaw.lib.e_sqlite3
SQLitePCLRaw.provider.e_sqlite3
Occuring error:
'SQLiteConnection' does not contain a definition for 'InsertWithChildren' and the best extension method overload 'WriteOperations.InsertWithChildren(SQLiteConnection, object, bool)' requires a receiver of type 'SQLiteConnection'
'SQLiteConnection' does not contain a definition for 'GetAllWithChildren' and the best extension method overload 'ReadOperations.GetAllWithChildren(SQLiteConnection, Expression>, bool)' requires a receiver of type 'SQLiteConnection'
Well that's how far I get. Anybody out there who knows what to do? Maybe remove conflicting references?
Ok I'm sure that its just a version problem because I just tried your code and it works fine for me. Try installing SQliteNetExtensions v 1.3.0 package from the NuGet package manager window in Visual Studio and nothing else. It will install all its dependencies.
Here is what I did - Try to do the same and see if this helps :
I Created a new Android Single View App Project in Visual Studio
(I'm using community 2017 - but it should not matter ) and created
the Stock , Entry and Database Classes and pasted your given
code respectively.
I installed only the SQliteNetExtensions v 1.3.0 package from the NuGet Package Manager
It installed the following dependencies along with it, I didn't installed these myself.
SQLite.Net-PCL v3.0.5
NewtonSoft.Json v6.0.8
Here is what I got after installing just SQliteNetExtensions v 1.3.0 package.
As you can see its showing an update for SQLite.Net-PCL v3.0.5 to v3.1.1 I tired also with the updated one and it still works fine , so its up to you to update or not.
Here a bit proof that its working fine. I also compiled and run the app on emulator and it works all fine.
Ok after a bit of searching , I came to know that the creator of this extension used a pattern called MvvmCross while developing it. So unless you are using that pattern model you will get this error.
For non-MvvmCross users they have to rebuild the source files and reference it in their project and not use the pre-compiled one, the one you are using.
Go to the fourth post on the following link
https://forums.xamarin.com/discussion/20117/sqlite-net-extensions-and-sqliteconnection here he tells how to rebuild from source in his post in a very brief manner.
Hope you will understand it but if not wait till I install Visual Studio and Xamarin and try it out myself so I can give you accurate steps.
It will take a while so till then , Kudos!
Here is the link to source files https://bitbucket.org/twincoders/sqlite-net-extensions/downloads/
Click on download repository
After some research I found out that:
Install-Package SQLiteNetExtensions -Version 2.0.0-alpha2 -Pre
depends on
Install-Package sqlite-net-pcl
instead of
Install-Package SQLite.Net-PCL -Version 3.1.1
But after removing all references, cleaning the solution and reinstalling the two needed packages there is no SQLite.net available anymore.
When trying to use SQLite instead:
'SQLiteConnection' does not contain a definition for 'InsertWithChildren' and the best extension method overload 'WriteOperations.InsertWithChildren(SQLiteConnection, object, bool)' requires a receiver of type 'SQLiteConnection'
I'm curious if it's even possible to develop Android-Apps with VS seamlessly. Since everything takes years to set up.
EDIT:
Well, after some days of pain in the a** the solution was to use the even newer pre release (alpha3) which wasn't even referenced to on the official pages. Currently I'm satisfied. :)
Install-Package SQLiteNetExtensions-netstandard -Version 2.0.0-alpha3 -Pre
Hope anybody may need this.
I just solved this after doing a whole load of updates. Hit the same issues.
Uninstall ALL SQLite plugins. See attached pic/link below.
Reinstall SQLiteNetExtensions and this installs all dependencies too, actually all files in that list except SQLite.Net-PCL.
SQLiteNetExtensions installs SQLite-net-pcl but you need the other one too so, install SQLite.Net-PCL as well.
Restart Visual Studio as it doesn't always pickup all newly installed packages, the reopen your solution.
That worked for me so hopefully it'll help someone else here too.

React Native Sqlite for android configuration

I am playing with react native for android and i have special interest with sqlite.
I try to use the sqlite lib here react-native-sqlite-storage buy i always have BUILD FAILED when "run-android". I'm a little lost at step 4 (How to use Android)
configuring the MainActivity
The error:
E:\Documents\Visual Studio CODE\MyApp\android\app\src\main\java\com\myapp\MainActivity.java:22: error: cannot find symbol
protected List getPackages() {
^
symbol: class List
location: class MainActivity
...
Have somebody a very simple sample project for android to see the correct conf?
thanks in advance.
You are missing import statement for the List.
import java.util.List;
#Override
protected List getPackages() {
//noinspection RedundantArrayCreation
return Arrays.asList(new ReactPackage[]{
new MainReactPackage(),
});
}
Any java IDE has some kind of fix import function so it would automatically propose you correct solution.
Try android studio it's free and react-native automatically generate gradle configuration. All you need to do is to import your project folder with gradle files (android by default) into IDE and press ctrl+space to turn IntelliSense on.
You should change MainAplication.java and not MainActivity.java

how to use Instrumentation under the uiautomator project?

I'm working on a uiautomator project recently and then the UiObject.getFromParent turn out a wrong element to me and I look into the source code of uiautomator and found out the answer is because by the UiSelector I used.
I found that the uiautomator is using the Instrumentation to get the UI element stuff just like :
getInstrumentation().getUiAutomation().getRootInActiveWindow();
I just want to get a AccessibilityNodeInfo node just like what uiautomator do but the uiautomator didn't exposed this.
I’m trying this way by a new class extends InstrumentationTestCase,by the getInstrumentation() always return a null to me.
i found an answer on
android instrumentation test case - getinstrumentation() returning null
that needs injectInstrumentation(InstrumentationRegistry.getInstrumentation());
and told InstrumentationRegistry is from the official Android testing-support-lib:0.1
I have download the Android Support Repository and import the testing-support-lib-0.1-source.jar into my project but I still can't see InstrumentationRegistry.
Anyone have any idea about my cast?
I'm using an extension of InstrumentationTestCase and it works just fine like this:
#Override
public void setUp() throws Exception{
super.setUp();
Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
AccessibilityNodeInfo root = instrumentation.getUiAutomation().getRootInActiveWindow();
}
I imported
import android.test.InstrumentationTestCase;
import android.support.test.InstrumentationRegistry;
import android.view.accessibility.AccessibilityNodeInfo;
and installed
Android Support Repository (15)
Android Support Library (22.2)
Hope it helps.
well,this question has beep solved by
unpack testing-support-lib-0.1.aar and get the classes.jar instead of
testing-support-lib-0.1-source.jar
.and now the eclipse will not saying can't resolved anymore.By the way,u have to
add this lib to Ant's javac classpath by edit build.xml
or else u will get a lib not found while u trying ant build.
but now the NEW question has turns out
INSTRUMENTATION_STATUS: stack=java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/test/InstrumentationRegistry;
maybe it's another question so i am going to find out via google and i will update this if figure it out or i will post a new question.
Frist tried:
i have noticed that the point of this question is the uiautomator didn't expose the api i want,and when i look into the source and found the UiDevice.dumpWindowHierarchy that has these code:
AccessibilityNodeInfo root =getAutomatorBridge().getQueryController().getAccessibilityRootNode();
the getAutomatorBridge was implemented by UiDevice:
UiAutomatorBridge getAutomatorBridge() {
if (mUiAutomationBridge == null) {
throw new RuntimeException("UiDevice not initialized");
}
return mUiAutomationBridge;
}
the point is there is no modifier on it,so what i have done is modified it's modifier to public ,modified the byte code of
/system/framework/uiautomator.jar
and the other one in sdk(sorry i don't,ya it worked!i can use it like this.
AccessibilityNodeInfo root =getUidevice().getAutomatorBridge().getQueryController().getAccessibilityRootNode();
but there is a compatibility issue isn't it?
Second tried:
Let's think about the default modifier of java,we can access it under the same package,so why don't we just implement a class has the same Package name ?then we can call it without any unnomal patch.
that's what i have done and it really works well:
package com.android.uiautomator.core;
import android.view.Display;
import android.view.accessibility.AccessibilityNodeInfo;
public class AutomationUltilites
{
public AutomationUltilites()
{
}
public static AccessibilityNodeInfo getRootNode()
{
return UiDevice.getInstance().getAutomatorBridge().getRootInActiveWindow();
}
public static Display getDisplay()
{
return UiDevice.getInstance().getAutomatorBridge().getDefaultDisplay();
}
}
Hope it helps.

Unable to run Bitmap sample code for Android

I am trying to run the sample from :
http://developer.android.com/training/displaying-bitmaps/display-bitmap.html
However I encountered lots of errors like:
Description Resource Path Location Type
BuildConfig cannot be resolved to a variable ImageGridFragment.java /ImageGridActivity/src/com/example/android/bitmapfun/ui line 124 Java Problem
Description Resource Path Location Type
SuppressLint cannot be resolved to a type Utils.java /ImageGridActivity/src/com/example/android/bitmapfun/util line 99 Java Problem
I ran thru Google but could get nothing. Adjusted the android build target to 4.0.3 (15) but still no clue. Anyone ran this sample successfully?
Thanks.
Here is my solution:
1.Create a new class:
package com.example.android.bitmapfun;
public class BuildConfig {
public static final boolean DEBUG = true;
}
2.Comment the lines that contain "SuppressLint":
//import android.annotation.SuppressLint;
// #SuppressLint("NewApi")
Android developer tools r17 brings a feature to Eclipse where a class is auto built at build-time, called BuildConfig, which contains a constant that can be used by the app developer to sense whether the build is a dev build or a production build. This feature appears to be in the Eclipse integration support, so when using IntelliJ, this useful feature is not available
In gen folder with R.java there should be BuildConfig.java if your program compiled successfully.
/** Automatically generated file. DO NOT MODIFY */
package com.example.android.bitmapfun;
public final class BuildConfig {
public final static boolean DEBUG = true;
}
Clean your project and try to launch it again.
It worked for me.
For me also it is not running directly import to eclipse. Just i put comments which lines is showing errors then it is working fine for me. May be it is not a right answer but we can see the application functionality by running the code so i did like that.

Categories

Resources