FlashDevelop error creating APK for simple project - android

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();
}
}

Related

I get a "Cannot resolve symbol class R" error after adding opencv module dependency to my project and trying to run the application

I'm doing a face recognition android application with opencv. When i try to run the project i get "Error:(3, 18) error: cannot find symbol class R" error. How can i solve this?
I'm trying to do a face recognition application and for that i'm using opencv. I wanted to try out a sample first so i followed few of the samples that were available.
I downloaded opencv4.0.1 and imported to my app in android studio -> Next changed the opencv gradle according to my gradle settings -> gradle files were synced succeessfully without errors -> Next as the tutorial stated i added the module dependency to my application where i selected the opencv module as the dependency.
Synced my gradle files. All was synced successfully.
I tried to run the application but the comes the error " Error:(3, 18) error: cannot find symbol class R" following "Error:(48, 78) error: package R does not exist".
This is one of the tutorials i followed as i'm completely new to opencv : https://www.learn2crack.com/2016/03/setup-opencv-sdk-android-studio.html
I already tried, cleaning & building the project again, invalidating and restarting the project, checking xml errors & etc. But none worked.
And this error is coming in some opencv files which i have mentioned below.
package org.opencv.android;
import org.opencv.R;
import android.content.Context;
import android.content.res.TypedArray;
import android.opengl.GLSurfaceView;
import android.util.AttributeSet;
import android.util.Log;
import android.view.SurfaceHolder;
public class CameraGLSurfaceView extends GLSurfaceView {
private static final String LOGTAG = "CameraGLSurfaceView";
public interface CameraTextureListener {
/**
* This method is invoked when camera preview has started. After this method is invoked
* the frames will start to be delivered to client via the onCameraFrame() callback.
* #param width - the width of the frames that will be delivered
* #param height - the height of the frames that will be delivered
*/
public void onCameraViewStarted(int width, int height);
/**
* This method is invoked when camera preview has been stopped for some reason.
* No frames will be delivered via onCameraFrame() callback after this method is called.
*/
public void onCameraViewStopped();
just replace :
res.srcDirs = ['/build/master_pack-android/opencv/modules/java/android_sdk/android_gradle_lib/res']
with :
res.srcDirs = ['res']
you can use Ctrl+Shift+F to find this line of code in the android studio OR navigate to gradle file of the OpenCV library

React Native Android app white screen won't start

I get the following error log when I run my Android app: http://pastebin.com/1jHEfdQ3 The app sometimes crashes in the simulator but most of the time it just displays a white screen. I can console.log one or two things until the app won't respond. R-R to refresh doesn't work. None of the dev tools work. I'm stumped with what to do at this point.
I'm running react native 0.38.0
EDIT:
I've tried cleaning my gradle and deleting and reinstalling my node modules.
One thing to note is that I am using React Native Navigation which means I had to modify MainApplication and MainActivity to the following:
MainActivity:
package com.prayerrequest;
import com.facebook.react.ReactActivity;
import com.reactnativenavigation.NavigationApplication;
import com.airbnb.android.react.maps.MapsPackage;
import com.cmcewen.blurview.BlurViewPackage;
import io.realm.react.RealmReactPackage;
import com.reactnativenavigation.controllers.SplashActivity;
public class MainActivity extends SplashActivity {
}
MainApplication:
package com.prayerrequest;
import com.facebook.react.ReactPackage;
import com.cmcewen.blurview.BlurViewPackage;
import io.realm.react.RealmReactPackage;
import com.airbnb.android.react.maps.MapsPackage;
import com.reactnativenavigation.NavigationApplication;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends NavigationApplication {
#Override
public boolean isDebug() {
// Make sure you are using BuildConfig from your own application
return BuildConfig.DEBUG;
}
#Override
public List<ReactPackage> createAdditionalReactPackages() {
return Arrays.<ReactPackage>asList(
new RealmReactPackage(),
new BlurViewPackage(),
new MapsPackage()
);
}
}
I've crossposted on React Native's issues page here
The issue seems to be 'Couldn't load memtrack module (No such file or directory)'
It looks like there's an issue with the simulator.
This is a config of my fully functional simulator:
Lots of other suggestions can be found here:
Couldn't load memtrack module Logcat Error
I had a similar problem. I would get this white screen when trying to get it to run on device.
The problem was when I would do adb devices or react-native run-android I would get "ADB is Not Recognized as an internal or external command".
So my fix was to add the path to adb.exe's parent directory to my Environment Variables and then restart my command prompts.I then ran react-native run-android and on startup no more red screen showing the completely useless error message Error calling AppRegistry.runApplication! :)
So I found ADB was located in my folder:
C:\Users\dell\AppData\Local\Android\sdk\platform-tools\adb.exe
I am on a Windows 10 system. dell is my user name of the computer.
So I went to System Environment Variables then found "Path" then clicked "Edit", then clicked "New" and added in "C:\Users\dell\AppData\Local\Android\sdk\platform-tools".

Android Testing with Robolectric: not recognizing Facebook SDK

We are trying to use the Robolectric testing framework in Android Studio in order to test the Facebook API. The Facebook Login button works so the Facebook API is working. However, the following test fails:
package com.airportapp.test.Models;
import android.app.Activity;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;
import org.robolectric.Robolectric;
import com.airportapp.test.MyRobolectricTestRunner;
import com.airportapp.LoginActivity;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
#RunWith(MyRobolectricTestRunner.class)
public class LoginActivityTest {
#Before
public void setup() {
//do whatever is necessary before every test
}
#Test
public void testActivityFound() {
Activity activity = Robolectric.buildActivity(LoginActivity.class).create().get();
Assert.assertNotNull(activity);
}
}
And the error is that Android Studio could not find the android.support file when we run the tests. You can see the error here:
The other error that shows up is:
android.view.InflateException: XML file app/src/main/res/layout/activity_login.xml line #-1 (sorry, not yet implemented): Error inflating class com.facebook.widget.LoginButton
So Android Studio is not happy with the facebook login button as well :( But it works... We think that we need to import something, but we don't know where to put it.
The InflateException is because Robolectric cannot find the resources from the Facebook SDK. To solve this, the project.properties file has to be updated to point to the Facebook SDK project. Do this by adding the following line to it:
android.library.reference.1={Path}
{Path} should be a relative path, from the project.properties file to the folder containing the AndroidManifest.xml of the Facebook SDK project. In my case that is ../../build/intermediates/exploded-aar/com.facebook.android/facebook/3.21.0.
Note that this works for all Android Library Projects which contain resources that aren't found by Robolectric. Further reading: here and here. Also, more documentation about project.properties can be found here. Note that in my project the Robolectric tests are located in the Android app project itself. So you could also try placing the project.properties file in the same directory as the AndroidManifest.xml used for testing.
As for your first problem; I have no personal experience with it. But it appears to be because Gradle cannot find the support libraries when compiling the unit tests. The answer from this question should fix it.

Why can't I run my app?

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.

android import error

I am trying use the GPE code for App-Android Android-App communication. Both the two new created folders (Android, AppEngine) have errors. I think the problem is that there are
errors with the packages:
import com.google.web.bindery.requestfactory.shared.InstanceRequest;
import com.google.web.bindery.requestfactory.shared.Request;
import com.google.web.bindery.requestfactory.shared.RequestContext;
import com.google.web.bindery.requestfactory.shared.RequestFactory;
import com.google.web.bindery.requestfactory.shared.ServiceName;
It says "The import com.google.web cannot be resolved." I tried adding everything able to be checked checked in the build path. I also know I installed the Web Toolkit and everything. What is wrong?
Statements like the following also have error markings:
#ProxyForName(value = "com.glm.server.Message",
locator = "com.glm.server.MessageLocator") and actually there are so many errors it must be the imports.

Categories

Resources